Jompatron commited on
Commit
f37bb94
·
1 Parent(s): ebf2e1b

button outside args

Browse files
Files changed (1) hide show
  1. app.py +21 -14
app.py CHANGED
@@ -116,17 +116,24 @@ def run_dashboard(forecast_days, hindcast_days):
116
  return forecast_plot, hindcast_plot
117
 
118
 
119
- iface = gr.Interface(
120
- fn=run_dashboard,
121
- inputs=[
122
- gr.Slider(3, 10, value=7, step=1, label="Forecast Days (future)"),
123
- gr.Slider(3, 10, value=7, step=1, label="Hindcast Days (past)"),
124
- gr.Button("Generate")
125
- ],
126
- outputs=[
127
- gr.Image(label="PM2.5 Forecast"),
128
- gr.Image(label="PM2.5 Hindcast")
129
- ],
130
- title="Air Quality Forecast Dashboard",
131
- description="Forecast and hindcast PM2.5 for Linköping using XGBoost + Hopsworks"
132
- )
 
 
 
 
 
 
 
 
116
  return forecast_plot, hindcast_plot
117
 
118
 
119
+ with gr.Blocks() as iface:
120
+
121
+ gr.Markdown("# Air Quality Forecast Dashboard")
122
+ gr.Markdown("Forecast and hindcast PM2.5 using XGBoost + Hopsworks")
123
+
124
+ with gr.Row():
125
+ forecast_days = gr.Slider(3, 10, value=7, step=1, label="Forecast Days (future)")
126
+ hindcast_days = gr.Slider(3, 10, value=7, step=1, label="Hindcast Days (past)")
127
+
128
+ generate_button = gr.Button("Generate")
129
+
130
+ forecast_img = gr.Image(label="PM2.5 Forecast")
131
+ hindcast_img = gr.Image(label="PM2.5 Hindcast")
132
+
133
+ generate_button.click(
134
+ fn=run_dashboard,
135
+ inputs=[forecast_days, hindcast_days],
136
+ outputs=[forecast_img, hindcast_img]
137
+ )
138
+
139
+ iface.launch()