Update app.py
Browse files
app.py
CHANGED
|
@@ -231,17 +231,6 @@ def get_column_names(file_obj):
|
|
| 231 |
print(f"Error in get_column_names: {e}")
|
| 232 |
return []
|
| 233 |
|
| 234 |
-
def update_dropdown_choices(file_obj):
|
| 235 |
-
"""
|
| 236 |
-
Updates the dropdown choices based on the uploaded file.
|
| 237 |
-
"""
|
| 238 |
-
try:
|
| 239 |
-
columns = get_column_names(file_obj)
|
| 240 |
-
return gr.Dropdown.update(choices=columns), gr.Dropdown.update(choices=columns)
|
| 241 |
-
except Exception as e:
|
| 242 |
-
logger.error(f"Error updating dropdown choices: {e}", exc_info=True)
|
| 243 |
-
return gr.Dropdown.update(choices=[]), gr.Dropdown.update(choices=[])
|
| 244 |
-
|
| 245 |
def create_interface():
|
| 246 |
with gr.Blocks() as iface:
|
| 247 |
gr.Markdown("""
|
|
@@ -250,16 +239,6 @@ def create_interface():
|
|
| 250 |
""")
|
| 251 |
|
| 252 |
file_input = gr.File(label="Upload Time Series Data (CSV, Excel, JSON, YAML)")
|
| 253 |
-
with gr.Row():
|
| 254 |
-
time_col_dropdown = gr.Dropdown(choices=[], label="Select Timestamp Column")
|
| 255 |
-
target_col_dropdown = gr.Dropdown(choices=[], label="Select Value Column")
|
| 256 |
-
|
| 257 |
-
update_dropdown_button = gr.Button("Update Dropdowns")
|
| 258 |
-
update_dropdown_button.click(
|
| 259 |
-
update_dropdown_choices,
|
| 260 |
-
inputs=[file_input],
|
| 261 |
-
outputs=[time_col_dropdown, target_col_dropdown]
|
| 262 |
-
)
|
| 263 |
|
| 264 |
with gr.Row():
|
| 265 |
forecast_horizon_input = gr.Number(label="Forecast Horizon", value=10)
|
|
@@ -282,7 +261,7 @@ def create_interface():
|
|
| 282 |
# Button to trigger the full pipeline
|
| 283 |
btn = gr.Button("Generate Forecast")
|
| 284 |
btn.click(
|
| 285 |
-
fn=
|
| 286 |
inputs=[file_input, forecast_horizon_input, finetune_steps_input, freq_dropdown, start_date_input, end_date_input, start_time_input, end_time_input, resample_freq_dropdown],
|
| 287 |
outputs=[output_html, output_plot, download_button, error_output]
|
| 288 |
)
|
|
|
|
| 231 |
print(f"Error in get_column_names: {e}")
|
| 232 |
return []
|
| 233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
def create_interface():
|
| 235 |
with gr.Blocks() as iface:
|
| 236 |
gr.Markdown("""
|
|
|
|
| 239 |
""")
|
| 240 |
|
| 241 |
file_input = gr.File(label="Upload Time Series Data (CSV, Excel, JSON, YAML)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
|
| 243 |
with gr.Row():
|
| 244 |
forecast_horizon_input = gr.Number(label="Forecast Horizon", value=10)
|
|
|
|
| 261 |
# Button to trigger the full pipeline
|
| 262 |
btn = gr.Button("Generate Forecast")
|
| 263 |
btn.click(
|
| 264 |
+
fn=full_forecast_pipeline,
|
| 265 |
inputs=[file_input, forecast_horizon_input, finetune_steps_input, freq_dropdown, start_date_input, end_date_input, start_time_input, end_time_input, resample_freq_dropdown],
|
| 266 |
outputs=[output_html, output_plot, download_button, error_output]
|
| 267 |
)
|