Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -203,20 +203,30 @@ with gr.Blocks() as demo:
|
|
| 203 |
output_table = gr.Dataframe(headers=['Expresi贸n', 'Normalizaci贸n'], label="Resultados", type="pandas")
|
| 204 |
output_logs = gr.Textbox(label="Logs", lines=5, interactive=False)
|
| 205 |
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
run_btn.click(
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
csv_io.seek(0)
|
| 217 |
-
return gr.File(file_obj=csv_io, visible=True)
|
| 218 |
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
|
|
|
| 221 |
demo.launch()
|
| 222 |
|
|
|
|
| 203 |
output_table = gr.Dataframe(headers=['Expresi贸n', 'Normalizaci贸n'], label="Resultados", type="pandas")
|
| 204 |
output_logs = gr.Textbox(label="Logs", lines=5, interactive=False)
|
| 205 |
|
| 206 |
+
# Despu茅s de definir output_table y output_logs:
|
| 207 |
+
download_btn = gr.Button("Descargar CSV")
|
| 208 |
+
csv_file_output = gr.File(label="Descargar resultados en CSV", visible=False)
|
| 209 |
+
|
| 210 |
+
# El click de procesar normales
|
| 211 |
+
run_btn.click(
|
| 212 |
+
fn=run_pipeline,
|
| 213 |
+
inputs=[files, raw_text, dct_input],
|
| 214 |
+
outputs=[output_table, output_logs]
|
| 215 |
+
)
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
# Funci贸n para exportar a CSV
|
| 218 |
+
def export_csv(df):
|
| 219 |
+
csv_path = "resultados.csv"
|
| 220 |
+
df.to_csv(csv_path, index=False)
|
| 221 |
+
return gr.update(value=csv_path, visible=True)
|
| 222 |
+
|
| 223 |
+
# Asociar el bot贸n de descarga al CSV
|
| 224 |
+
download_btn.click(
|
| 225 |
+
fn=export_csv,
|
| 226 |
+
inputs=[output_table],
|
| 227 |
+
outputs=[csv_file_output]
|
| 228 |
+
)
|
| 229 |
|
| 230 |
+
# Lanzar la app
|
| 231 |
demo.launch()
|
| 232 |
|