Ajaykanth Maddi commited on
Commit
015728f
·
1 Parent(s): 1fc5b91

Export Button UI Changes

Browse files
Files changed (1) hide show
  1. app.py +19 -12
app.py CHANGED
@@ -179,6 +179,11 @@ initial_subset = available_subsets[0] if available_subsets else None
179
  # initial_summary = update_summary(initial_subset) if initial_subset else "No data available"
180
  initial_plot = plot_subset_metrics(initial_subset) if initial_subset else "No data available"
181
 
 
 
 
 
 
182
 
183
  def export_data(orig_ans_display,
184
  y_metrics_display,
@@ -393,17 +398,19 @@ with gr.Blocks(
393
  )
394
 
395
  # Add export button
396
- export_btn = gr.Button("💾 Export Locally", variant="primary")
397
- download_output = gr.File(label="Download File", visible=False)
398
- export_btn.click(
399
- fn=export_data,
400
- inputs=[
401
- orig_ans_display,
402
- y_metrics_display,
403
- gen_ans_display,
404
- y_pred_metrics_display,
405
- ],
406
- outputs=download_output
407
- )
 
 
408
 
409
  demo.launch(debug=True, prevent_thread_lock=True, share=True)
 
179
  # initial_summary = update_summary(initial_subset) if initial_subset else "No data available"
180
  initial_plot = plot_subset_metrics(initial_subset) if initial_subset else "No data available"
181
 
182
+ def generate_file(text):
183
+ # Save to file inside Space
184
+ with open("output.txt", "w") as f:
185
+ f.write(text)
186
+ return "output.txt"
187
 
188
  def export_data(orig_ans_display,
189
  y_metrics_display,
 
398
  )
399
 
400
  # Add export button
401
+ gr.Interface(fn=generate_file, inputs="CheckTheDownloadcapability", outputs="file").launch()
402
+
403
+ # export_btn = gr.Button("💾 Export Locally", variant="primary")
404
+ # download_output = gr.File(label="Download File", visible=False)
405
+ # export_btn.click(
406
+ # fn=export_data,
407
+ # inputs=[
408
+ # orig_ans_display,
409
+ # y_metrics_display,
410
+ # gen_ans_display,
411
+ # y_pred_metrics_display,
412
+ # ],
413
+ # outputs=download_output
414
+ # )
415
 
416
  demo.launch(debug=True, prevent_thread_lock=True, share=True)