de-Rodrigo commited on
Commit
af68571
1 Parent(s): 4940e34

Donwloadable Table

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -7,6 +7,7 @@ from bokeh.layouts import row, column
7
  from bokeh.palettes import Reds9, Blues9
8
  from sklearn.decomposition import PCA
9
  from sklearn.manifold import TSNE
 
10
 
11
  TOOLTIPS = """
12
  <div>
@@ -267,10 +268,23 @@ def run_model(model_name):
267
  }
268
  """)
269
  reset_button.js_on_event("button_click", reset_callback)
 
 
 
 
 
 
 
 
 
 
 
 
270
 
271
  layout = column(fig, column(real_select, reset_button, data_table))
272
  st.bokeh_chart(layout, use_container_width=True)
273
 
 
274
  # Funci贸n principal con tabs para cambiar de modelo
275
  def main():
276
  config_style()
 
7
  from bokeh.palettes import Reds9, Blues9
8
  from sklearn.decomposition import PCA
9
  from sklearn.manifold import TSNE
10
+ import io
11
 
12
  TOOLTIPS = """
13
  <div>
 
268
  }
269
  """)
270
  reset_button.js_on_event("button_click", reset_callback)
271
+
272
+ buffer = io.BytesIO()
273
+ df_table.to_excel(buffer, index=False)
274
+ buffer.seek(0)
275
+
276
+ # Agregar un bot贸n de descarga en Streamlit
277
+ st.download_button(
278
+ label="Exportar tabla a Excel",
279
+ data=buffer,
280
+ file_name="tabla.xlsx",
281
+ mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
282
+ )
283
 
284
  layout = column(fig, column(real_select, reset_button, data_table))
285
  st.bokeh_chart(layout, use_container_width=True)
286
 
287
+
288
  # Funci贸n principal con tabs para cambiar de modelo
289
  def main():
290
  config_style()