Spaces:
Build error
Build error
Ashkan Taghipour (The University of Western Australia) Claude Opus 4.6 commited on
Commit ·
9fc7d91
1
Parent(s): 1185c9e
Fix Your Report tab: remove duplicate outputs causing Gradio error
Browse filesThe generate report callback had final_download_json and final_download_csv
each listed twice in outputs (value + visibility). Gradio 6.x does not
allow duplicate components in outputs. Fixed by using gr.File(value, visible)
to set both in a single return value, reducing outputs from 7 to 5.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- app.py +0 -2
- src/callbacks.py +7 -1
- tests/test_integration.py +1 -1
app.py
CHANGED
|
@@ -400,8 +400,6 @@ with demo:
|
|
| 400 |
C["final_report_md"],
|
| 401 |
C["final_download_json"],
|
| 402 |
C["final_download_csv"],
|
| 403 |
-
C["final_download_json"], # visibility
|
| 404 |
-
C["final_download_csv"], # visibility
|
| 405 |
C["final_achievements_html"],
|
| 406 |
C["state"],
|
| 407 |
],
|
|
|
|
| 400 |
C["final_report_md"],
|
| 401 |
C["final_download_json"],
|
| 402 |
C["final_download_csv"],
|
|
|
|
|
|
|
| 403 |
C["final_achievements_html"],
|
| 404 |
C["state"],
|
| 405 |
],
|
src/callbacks.py
CHANGED
|
@@ -476,7 +476,13 @@ def on_generate_report(state: AppState, data: dict) -> tuple:
|
|
| 476 |
f'<span class="achievement-badge">{a}</span>'
|
| 477 |
for a in sorted(state.achievements)
|
| 478 |
)
|
| 479 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
|
| 481 |
|
| 482 |
# ============================================================
|
|
|
|
| 476 |
f'<span class="achievement-badge">{a}</span>'
|
| 477 |
for a in sorted(state.achievements)
|
| 478 |
)
|
| 479 |
+
return (
|
| 480 |
+
report_md,
|
| 481 |
+
gr.File(value=json_path, visible=True),
|
| 482 |
+
gr.File(value=csv_path, visible=True),
|
| 483 |
+
badges,
|
| 484 |
+
state,
|
| 485 |
+
)
|
| 486 |
|
| 487 |
|
| 488 |
# ============================================================
|
tests/test_integration.py
CHANGED
|
@@ -47,7 +47,7 @@ class TestFullFlow:
|
|
| 47 |
assert gene_id in state.backpack_genes
|
| 48 |
|
| 49 |
# Step 7: Generate report
|
| 50 |
-
report_md,
|
| 51 |
assert len(report_md) > 100
|
| 52 |
assert "Cartographer" in state.achievements
|
| 53 |
|
|
|
|
| 47 |
assert gene_id in state.backpack_genes
|
| 48 |
|
| 49 |
# Step 7: Generate report
|
| 50 |
+
report_md, json_file, csv_file, badges, state = on_generate_report(state, synthetic_data)
|
| 51 |
assert len(report_md) > 100
|
| 52 |
assert "Cartographer" in state.achievements
|
| 53 |
|