Update app.py
Browse files
app.py
CHANGED
@@ -86,13 +86,12 @@ def convert_schedule(file_path, direction):
|
|
86 |
# For display, include index as a column
|
87 |
display_df = result.reset_index().rename(columns={'index': first_col_name})
|
88 |
|
89 |
-
|
90 |
output_filename = f"converted_{uuid.uuid4().hex}.xlsx"
|
91 |
-
|
92 |
-
display_df.to_excel(output_filename, engine='openpyxl', index=False)
|
93 |
|
94 |
# Return both DataFrame and download path
|
95 |
-
|
96 |
|
97 |
# Build Gradio interface and launch immediately for Hugging Face Spaces
|
98 |
iface = gr.Interface(
|
@@ -112,4 +111,5 @@ iface = gr.Interface(
|
|
112 |
),
|
113 |
flagging_mode='never'
|
114 |
)
|
|
|
115 |
iface.launch(server_name='0.0.0.0', server_port=7860)
|
|
|
86 |
# For display, include index as a column
|
87 |
display_df = result.reset_index().rename(columns={'index': first_col_name})
|
88 |
|
89 |
+
# 6. Save to Excel for download (relative path so Gradio can serve it)
|
90 |
output_filename = f"converted_{uuid.uuid4().hex}.xlsx"
|
91 |
+
result.to_excel(output_filename, engine='openpyxl', index=True)
|
|
|
92 |
|
93 |
# Return both DataFrame and download path
|
94 |
+
return display_df, output_filename
|
95 |
|
96 |
# Build Gradio interface and launch immediately for Hugging Face Spaces
|
97 |
iface = gr.Interface(
|
|
|
111 |
),
|
112 |
flagging_mode='never'
|
113 |
)
|
114 |
+
# Launch on 0.0.0.0:7860 for Spaces
|
115 |
iface.launch(server_name='0.0.0.0', server_port=7860)
|