nesticot commited on
Commit
2f6d561
·
verified ·
1 Parent(s): 176e300

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -87,7 +87,8 @@ app_ui = ui.page_fluid(
87
  ),
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
  ),
92
 
93
  ui.panel_main(
@@ -275,7 +276,12 @@ def server(input, output, session):
275
  fig.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)
276
 
277
 
278
-
 
 
 
 
 
279
 
280
 
281
  app = App(app_ui, server)
 
87
  ),
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(
 
276
  fig.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)
277
 
278
 
279
+ # Download handler for CSV
280
+ @session.download(filename="data.csv")
281
+ def download_data():
282
+ # Get the current dataset and save it to CSV
283
+ return cached_data().to_csv()
284
+
285
 
286
 
287
  app = App(app_ui, server)