Update app.py
Browse files
app.py
CHANGED
@@ -81,12 +81,12 @@ def convert_schedule(file_path, direction):
|
|
81 |
result.index.name = None
|
82 |
result.columns.name = None
|
83 |
|
84 |
-
|
85 |
-
os.makedirs('/mnt/data', exist_ok=True)
|
86 |
output_filename = f"converted_{uuid.uuid4().hex}.xlsx"
|
87 |
-
output_path = os.path.join(
|
88 |
result.to_excel(output_path, engine='openpyxl', index=True)
|
89 |
|
|
|
90 |
return result, output_path
|
91 |
|
92 |
# Gradio UI definition
|
@@ -109,7 +109,4 @@ def main():
|
|
109 |
),
|
110 |
allow_flagging='never'
|
111 |
)
|
112 |
-
iface.launch(server_name='0.0.0.0', server_port=7860
|
113 |
-
|
114 |
-
if __name__ == '__main__':
|
115 |
-
main()
|
|
|
81 |
result.index.name = None
|
82 |
result.columns.name = None
|
83 |
|
84 |
+
# 6. Save to Excel for download in the current working directory
|
|
|
85 |
output_filename = f"converted_{uuid.uuid4().hex}.xlsx"
|
86 |
+
output_path = os.path.join(os.getcwd(), output_filename)
|
87 |
result.to_excel(output_path, engine='openpyxl', index=True)
|
88 |
|
89 |
+
# Return both DataFrame and download path
|
90 |
return result, output_path
|
91 |
|
92 |
# Gradio UI definition
|
|
|
109 |
),
|
110 |
allow_flagging='never'
|
111 |
)
|
112 |
+
iface.launch(server_name='0.0.0.0', server_port=7860)
|
|
|
|
|
|