Spaces:
Runtime error
Runtime error
Update app.py (#14)
Browse files- Update app.py (f5cd4f86625bd037966c3b8266a6dda3b88d8429)
Co-authored-by: Manay Porwal <manayporwal07@users.noreply.huggingface.co>
app.py
CHANGED
|
@@ -329,10 +329,15 @@ with gr.Blocks() as demo:
|
|
| 329 |
|
| 330 |
def on_run(file_in):
|
| 331 |
(gallery_items, captions), metrics_df, lb = run_evaluation(file_in)
|
| 332 |
-
gallery_display = [(p, captions[i] if i < len(captions) else "") for i, p in enumerate(gallery_items)]
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
|
| 337 |
gr.Markdown("## Tips\n- Ensure columns: `task_id,prompt,response,agent,reference` "
|
| 338 |
"(case-insensitive).\n- Visualization images in Gallery.\n- Download CSV after evaluation.")
|
|
|
|
| 329 |
|
| 330 |
def on_run(file_in):
|
| 331 |
(gallery_items, captions), metrics_df, lb = run_evaluation(file_in)
|
| 332 |
+
gallery_display = [(p, captions[i] if i < len(captions) else "") for i, p in enumerate(gallery_items)] if gallery_items else []
|
| 333 |
+
csv_path = "/tmp/eval_results.csv" # ensure CSV report is downloadable
|
| 334 |
+
return gallery_display, metrics_df, lb, csv_path
|
| 335 |
+
|
| 336 |
+
run_btn.click(
|
| 337 |
+
fn=on_run,
|
| 338 |
+
inputs=[file_input],
|
| 339 |
+
outputs=[gallery, table, leaderboard, download_report]
|
| 340 |
+
)
|
| 341 |
|
| 342 |
gr.Markdown("## Tips\n- Ensure columns: `task_id,prompt,response,agent,reference` "
|
| 343 |
"(case-insensitive).\n- Visualization images in Gallery.\n- Download CSV after evaluation.")
|