nesticot commited on
Commit
9aade26
·
verified ·
1 Parent(s): 64795ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -88,7 +88,7 @@ app_ui = ui.page_fluid(
88
 
89
  # Row for the action button to generate plot
90
  ui.row(ui.input_action_button("generate_plot", "Generate Plot", class_="btn-primary")),
91
- # ui.row(ui.download_button("download_data", "Download CSV"))
92
  ),
93
 
94
  ui.panel_main(
@@ -275,7 +275,12 @@ def server(input, output, session):
275
 
276
  fig.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)
277
 
278
-
 
 
 
 
 
279
 
280
  app = App(app_ui, server)
281
 
 
88
 
89
  # Row for the action button to generate plot
90
  ui.row(ui.input_action_button("generate_plot", "Generate Plot", class_="btn-primary")),
91
+ ui.row(ui.download_button("download_data", "Download CSV"))
92
  ),
93
 
94
  ui.panel_main(
 
275
 
276
  fig.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)
277
 
278
+
279
+ @session.download(filename="sample_data.csv")
280
+ def download():
281
+ # When running in Hugging Face space, we need to use a temporary file
282
+ yield cached_data().write_csv()
283
+
284
 
285
  app = App(app_ui, server)
286