Update app.py
Browse files275 unmodified lines276277278279280281282283284285286287288289290291275 unmodified linesfig.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)# Download handler for CSV@session.download(filename="data.csv")def download_data():# Create a string bufferbuffer = StringIO()# Write the DataFrame to the buffercached_data().write_csv(buffer)buffer.seek(0)# Get the string value and return itreturn buffer.getvalue()275 unmodified lines276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306275 unmodified linesfig.subplots_adjust(left=0.01, right=0.99, top=0.99, bottom=0.01)# # Download handler for CSV# @session.download(filename="data.csv")# def download_data():# # Create a string buffer# buffer = StringIO()# # Write the DataFrame to the buffer# cached_data().write_csv(buffer)# buffer.seek(0)# # Get the string value and return it# return buffer.getvalue()# Reactive expression for the dataset@reactive.calcdef dataset():np.random.seed(123)return pd.DataFrame({'x': np.random.normal(0, 1, input.num_points()),'y': np.random.normal(0, 1, input.num_points())})# Download handler for CSV@session.download(filename="data.csv")def download_data():# Get the current dataset and save it to CSVreturn dataset().to_csv(index=False)
app.py+22-7