Spaces:
Starting
on
A100
Starting
on
A100
Commit
Β·
22ae8d0
1
Parent(s):
08bb076
Add system
Browse files- app.py +4 -4
- system/pledge_tracking.py +5 -13
- test.html +14 -7
app.py
CHANGED
@@ -175,10 +175,10 @@ def run_model():
|
|
175 |
"events": events
|
176 |
}
|
177 |
default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"
|
178 |
-
step_id = outputs["step_id"]
|
179 |
-
if update_status:
|
180 |
-
|
181 |
-
|
182 |
with open(default_log_path, "w") as f:
|
183 |
f.write(json.dumps(log_entry, indent=1))
|
184 |
|
|
|
175 |
"events": events
|
176 |
}
|
177 |
default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"
|
178 |
+
# step_id = outputs["step_id"]
|
179 |
+
# if update_status:
|
180 |
+
# update_status(step_id, "All done!")
|
181 |
+
# step_id += 1
|
182 |
with open(default_log_path, "w") as f:
|
183 |
f.write(json.dumps(log_entry, indent=1))
|
184 |
|
system/pledge_tracking.py
CHANGED
@@ -27,17 +27,9 @@ def count_total_events(output_path):
|
|
27 |
with open(output_path, "r", encoding="utf-8") as f:
|
28 |
results = json.load(f)
|
29 |
|
30 |
-
print(results)
|
31 |
total_events = 0
|
32 |
-
for
|
33 |
-
|
34 |
-
events = item["output"]
|
35 |
-
if isinstance(events, list):
|
36 |
-
total_events += len(events)
|
37 |
-
else:
|
38 |
-
print(f"invalid: {events}")
|
39 |
-
except KeyError:
|
40 |
-
print(f"lack item: {item}")
|
41 |
|
42 |
print(f"{total_events} events in total")
|
43 |
return total_events
|
@@ -187,9 +179,9 @@ def run_pipeline(claim, pledge_date, pledge_author, start_date, timestamp, user_
|
|
187 |
df.to_excel(sorted_event_path, index=False)
|
188 |
print(sorted_event_path)
|
189 |
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
|
194 |
return {
|
195 |
"claim_json": claim_json_path,
|
|
|
27 |
with open(output_path, "r", encoding="utf-8") as f:
|
28 |
results = json.load(f)
|
29 |
|
|
|
30 |
total_events = 0
|
31 |
+
for result in results:
|
32 |
+
total_events+= len(result["output"]["events"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
print(f"{total_events} events in total")
|
35 |
return total_events
|
|
|
179 |
df.to_excel(sorted_event_path, index=False)
|
180 |
print(sorted_event_path)
|
181 |
|
182 |
+
if update_fn:
|
183 |
+
update_fn(step_id, "All done!")
|
184 |
+
step_id += 1
|
185 |
|
186 |
return {
|
187 |
"claim_json": claim_json_path,
|
test.html
CHANGED
@@ -245,13 +245,20 @@
|
|
245 |
const finalText = values.join(" ").toLowerCase();
|
246 |
|
247 |
if (finalText.includes("done") || finalText.includes("finished")) {
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
clearInterval(window.pollIntervalId);
|
256 |
window.pollIntervalId = null;
|
257 |
statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">β The process failed.</div>`;
|
|
|
245 |
const finalText = values.join(" ").toLowerCase();
|
246 |
|
247 |
if (finalText.includes("done") || finalText.includes("finished")) {
|
248 |
+
clearInterval(window.pollIntervalId);
|
249 |
+
window.pollIntervalId = null;
|
250 |
+
statusElement.innerHTML += `<div class="mt-2 text-green-600 font-semibold">β
All done.</div>`;
|
251 |
+
checkBtn.disabled = false;
|
252 |
+
checkBtn.classList.remove("opacity-50", "cursor-not-allowed");
|
253 |
+
|
254 |
+
// π ηεΎ
lastUsedFile εε€ε₯½
|
255 |
+
const waitForFile = setInterval(() => {
|
256 |
+
if (lastUsedFile) {
|
257 |
+
clearInterval(waitForFile);
|
258 |
+
loadEvents(lastUsedFile);
|
259 |
+
}
|
260 |
+
}, 200);
|
261 |
+
} else if (finalText.includes("error") || finalText.includes("fail")) {
|
262 |
clearInterval(window.pollIntervalId);
|
263 |
window.pollIntervalId = null;
|
264 |
statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">β The process failed.</div>`;
|