Spaces:
Sleeping
Sleeping
Commit ·
22ae8d0
1
Parent(s): 08bb076
Add system
Browse filesFiles changed (3)
- app.py+4-4
- system/pledge_tracking.py+5-13
- test.html+14-7
174 unmodified lines175176177178179180181182183184174 unmodified lines"events": events}default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"step_id = outputs["step_id"]if update_status:update_status(step_id, "All done!")step_id += 1with open(default_log_path, "w") as f:f.write(json.dumps(log_entry, indent=1))174 unmodified lines175176177178179180181182183184174 unmodified lines"events": events}default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"# step_id = outputs["step_id"]# if update_status:# update_status(step_id, "All done!")# step_id += 1with open(default_log_path, "w") as f:f.write(json.dumps(log_entry, indent=1))
26 unmodified lines2728293031323334353637383940414243143 unmodified lines18718818919019119219319419526 unmodified lineswith open(output_path, "r", encoding="utf-8") as f:results = json.load(f)print(results)total_events = 0for item in results:try:events = item["output"]if isinstance(events, list):total_events += len(events)else:print(f"invalid: {events}")except KeyError:print(f"lack item: {item}")print(f"{total_events} events in total")return total_events143 unmodified linesdf.to_excel(sorted_event_path, index=False)print(sorted_event_path)# if update_fn:# update_fn(step_id, "All done!")# step_id += 1return {"claim_json": claim_json_path,26 unmodified lines272829303132333435143 unmodified lines17918018118218318418518618726 unmodified lineswith open(output_path, "r", encoding="utf-8") as f:results = json.load(f)total_events = 0for result in results:total_events+= len(result["output"]["events"])print(f"{total_events} events in total")return total_events143 unmodified linesdf.to_excel(sorted_event_path, index=False)print(sorted_event_path)if update_fn:update_fn(step_id, "All done!")step_id += 1return {"claim_json": claim_json_path,
244 unmodified lines245246247248249250251252253254255256257244 unmodified linesconst finalText = values.join(" ").toLowerCase();if (finalText.includes("done") || finalText.includes("finished")) {clearInterval(window.pollIntervalId);window.pollIntervalId = null;statusElement.innerHTML += `<div class="mt-2 text-green-600 font-semibold">✅ All done.</div>`;checkBtn.disabled = false;checkBtn.classList.remove("opacity-50", "cursor-not-allowed");if (lastUsedFile) loadEvents(lastUsedFile);} else if (finalText.includes("error") || finalText.includes("fail")) {clearInterval(window.pollIntervalId);window.pollIntervalId = null;statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">❌ The process failed.</div>`;244 unmodified lines245246247248249250251252253254255256257258259260261262263264244 unmodified linesconst finalText = values.join(" ").toLowerCase();if (finalText.includes("done") || finalText.includes("finished")) {clearInterval(window.pollIntervalId);window.pollIntervalId = null;statusElement.innerHTML += `<div class="mt-2 text-green-600 font-semibold">✅ All done.</div>`;checkBtn.disabled = false;checkBtn.classList.remove("opacity-50", "cursor-not-allowed");// 🕐 等待 lastUsedFile 准备好const waitForFile = setInterval(() => {if (lastUsedFile) {clearInterval(waitForFile);loadEvents(lastUsedFile);}}, 200);} else if (finalText.includes("error") || finalText.includes("fail")) {clearInterval(window.pollIntervalId);window.pollIntervalId = null;statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">❌ The process failed.</div>`;
app.py+4-4
system/pledge_tracking.py+5-13
test.html+14-7