Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -122,10 +122,8 @@ def download_current_message_database():
|
|
122 |
output = io.BytesIO()
|
123 |
df.to_excel(output, index=False)
|
124 |
output.seek(0) # Reset pointer
|
125 |
-
#
|
126 |
-
output.
|
127 |
-
# Return the output directly
|
128 |
-
return output
|
129 |
else:
|
130 |
return None
|
131 |
|
@@ -1854,7 +1852,7 @@ with gr.Blocks() as demo:
|
|
1854 |
|
1855 |
with gr.Row():
|
1856 |
download_btn = gr.Button("Выгрузить актуальную базу сообщений")
|
1857 |
-
|
1858 |
|
1859 |
# Очистка всех полей кроме prompt_display
|
1860 |
description_input.change(
|
@@ -2520,7 +2518,7 @@ with gr.Blocks() as demo:
|
|
2520 |
download_btn.click(
|
2521 |
fn=download_current_message_database,
|
2522 |
inputs=[],
|
2523 |
-
outputs=
|
2524 |
)
|
2525 |
|
2526 |
demo.launch()
|
|
|
122 |
output = io.BytesIO()
|
123 |
df.to_excel(output, index=False)
|
124 |
output.seek(0) # Reset pointer
|
125 |
+
# Return bytes data and filename as a tuple
|
126 |
+
return (output.read(), "messages.xlsx")
|
|
|
|
|
127 |
else:
|
128 |
return None
|
129 |
|
|
|
1852 |
|
1853 |
with gr.Row():
|
1854 |
download_btn = gr.Button("Выгрузить актуальную базу сообщений")
|
1855 |
+
download_component = gr.Download(label="Скачать базу сообщений")
|
1856 |
|
1857 |
# Очистка всех полей кроме prompt_display
|
1858 |
description_input.change(
|
|
|
2518 |
download_btn.click(
|
2519 |
fn=download_current_message_database,
|
2520 |
inputs=[],
|
2521 |
+
outputs=download_component
|
2522 |
)
|
2523 |
|
2524 |
demo.launch()
|