lisabdunlap commited on
Commit
12521d7
·
verified ·
1 Parent(s): c56227b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -311,6 +311,23 @@ def create_vibecheck_results_ui():
311
  outputs=[load_examples_md],
312
  )
313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  # Add a footer
315
  gr.HTML("""
316
  <div class="footer">
 
311
  outputs=[load_examples_md],
312
  )
313
 
314
+ # Function to convert DataFrame to CSV and return for download
315
+ def download_dataframe(results_dict):
316
+ if not results_dict or "df" not in results_dict:
317
+ return None
318
+
319
+ # Convert DataFrame to CSV
320
+ csv_file_path = "vibecheck_results.csv"
321
+ results_dict["df"].to_csv(csv_file_path, index=False)
322
+ return csv_file_path
323
+
324
+ # Connect the download button to the function
325
+ download_btn.click(
326
+ fn=download_dataframe,
327
+ inputs=[load_results_state],
328
+ outputs=[download_file]
329
+ )
330
+
331
  # Add a footer
332
  gr.HTML("""
333
  <div class="footer">