Update app.py
Browse files
app.py
CHANGED
@@ -92,4 +92,24 @@ def convert_schedule(file_path, direction):
|
|
92 |
display_df.to_excel(output_filename, engine='openpyxl', index=False)
|
93 |
|
94 |
# Return both DataFrame and download path
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
display_df.to_excel(output_filename, engine='openpyxl', index=False)
|
93 |
|
94 |
# Return both DataFrame and download path
|
95 |
+
return display_df, output_filename
|
96 |
+
|
97 |
+
# Build Gradio interface and launch immediately for Hugging Face Spaces
|
98 |
+
iface = gr.Interface(
|
99 |
+
fn=convert_schedule,
|
100 |
+
inputs=[
|
101 |
+
gr.File(label='Upload Weekly Schedule (.xlsx)', file_count='single', type='filepath'),
|
102 |
+
gr.Radio(['A to B', 'B to A'], label='Convert Direction')
|
103 |
+
],
|
104 |
+
outputs=[
|
105 |
+
gr.Dataframe(label='Converted Schedule'),
|
106 |
+
gr.File(label='Download Converted Excel')
|
107 |
+
],
|
108 |
+
title='7-Day Schedule Converter',
|
109 |
+
description=(
|
110 |
+
'Upload a 7-column weekly schedule (Models vs Days) with merged or single headers, '
|
111 |
+
'then flip between Models→Texters or Texters→Models. Download the result as .xlsx.'
|
112 |
+
),
|
113 |
+
flagging_mode='never'
|
114 |
+
)
|
115 |
+
iface.launch(server_name='0.0.0.0', server_port=7860)
|