Supastrikas-004 manayporwal07 commited on
Commit
d4e4912
Β·
verified Β·
1 Parent(s): 4d582f1

Update app.py (#14)

Browse files

- Update app.py (f5cd4f86625bd037966c3b8266a6dda3b88d8429)


Co-authored-by: Manay Porwal <manayporwal07@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +9 -4
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
- return gallery_display, metrics_df, lb
334
-
335
- run_btn.click(fn=on_run, inputs=[file_input], outputs=[gallery, table, leaderboard])
 
 
 
 
 
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.")