Spaces:
Running on Zero
Running on Zero
fix: keep synthesis progress active until result
Browse files- app.py +4 -3
- frontend/static/app.jsx +5 -2
app.py
CHANGED
|
@@ -82,9 +82,10 @@ def _model_assist_gpu(*, engine, result, narrative_text):
|
|
| 82 |
return run_model_assist(engine=engine, result=result, narrative_text=narrative_text)
|
| 83 |
|
| 84 |
|
| 85 |
-
#
|
| 86 |
-
#
|
| 87 |
-
|
|
|
|
| 88 |
|
| 89 |
|
| 90 |
def _file_fields(trace_file: object) -> tuple[str | None, str | None]:
|
|
|
|
| 82 |
return run_model_assist(engine=engine, result=result, narrative_text=narrative_text)
|
| 83 |
|
| 84 |
|
| 85 |
+
# Completed-step count for the frontend's 6-item checklist. Keep the final
|
| 86 |
+
# synthesis row active until the final payload is ready, because model assist
|
| 87 |
+
# runs after deterministic synthesis on the ZeroGPU path.
|
| 88 |
+
_STEP_COUNT = {"extract": 2, "redact": 3, "chart": 4, "classify": 5, "synthesize": 5}
|
| 89 |
|
| 90 |
|
| 91 |
def _file_fields(trace_file: object) -> tuple[str | None, str | None]:
|
frontend/static/app.jsx
CHANGED
|
@@ -308,8 +308,11 @@ function App() {
|
|
| 308 |
if (msg.type === "data") {
|
| 309 |
const p = Array.isArray(msg.data) ? msg.data[0] : msg.data;
|
| 310 |
if (p && typeof p === "object") {
|
| 311 |
-
if (
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
| 313 |
}
|
| 314 |
} else if (msg.type === "status") {
|
| 315 |
if (msg.stage === "error") throw new Error(msg.message || "The analyzer failed on the server.");
|
|
|
|
| 308 |
if (msg.type === "data") {
|
| 309 |
const p = Array.isArray(msg.data) ? msg.data[0] : msg.data;
|
| 310 |
if (p && typeof p === "object") {
|
| 311 |
+
if (p.result) {
|
| 312 |
+
result = p.result;
|
| 313 |
+
} else if (typeof p.step === "number") {
|
| 314 |
+
setStep(Math.min(p.step, PIPELINE.length - 1));
|
| 315 |
+
}
|
| 316 |
}
|
| 317 |
} else if (msg.type === "status") {
|
| 318 |
if (msg.stage === "error") throw new Error(msg.message || "The analyzer failed on the server.");
|