saba000farahani commited on
Commit
44a1d05
1 Parent(s): 15be706

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -144,7 +144,7 @@ def predict_and_plot(velocity, temperature, precipitation, humidity):
144
 
145
  inputs = [
146
  gr.Slider(minimum=0, maximum=100, value=50, step=0.05, label="Velocity (mph)"),
147
- gr.Slider(minimum=-2, maximum=30, value=0, step=0.5, label="Temperature (°C)"),
148
  gr.Slider(minimum=0, maximum=1, value=0, step=0.01, label="Precipitation (inch)"),
149
  gr.Slider(minimum=0, maximum=100, value=50, label="Humidity (%)")
150
  ]
@@ -186,16 +186,13 @@ with gr.Blocks() as demo:
186
  gr.Markdown("### Input Parameters")
187
  for inp in inputs:
188
  inp.render()
189
- gr.Button(value="Submit", variant="primary").click(
190
- fn=predict_and_plot,
191
- inputs=inputs,
192
- outputs= [gr.Plot(label="Contamination Levels Over Time")]+ contamination_outputs + gradients_outputs + cleaning_time_outputs)
193
- gr.Button(value="Clear").click(fn=lambda: None)
194
 
195
  with gr.Column(scale=1):
196
  gr.Image(image_path)
197
 
198
- # Bottom Section: Outputs (Three columns) and Plot Below
199
  with gr.Row():
200
  with gr.Column(scale=2):
201
  gr.Markdown("### Contamination Predictions")
@@ -214,8 +211,13 @@ with gr.Blocks() as demo:
214
 
215
  # Graph below the outputs
216
  with gr.Row():
217
- with gr.Column():
218
- gr.Markdown("### Contamination Levels Over Time")
219
- gr.Plot(label="Contamination Levels Over Time")
 
 
 
 
 
220
 
221
  demo.launch()
 
144
 
145
  inputs = [
146
  gr.Slider(minimum=0, maximum=100, value=50, step=0.05, label="Velocity (mph)"),
147
+ gr.Slider(minimum=-2, maximum 30, value=0, step=0.5, label="Temperature (°C)"),
148
  gr.Slider(minimum=0, maximum=1, value=0, step=0.01, label="Precipitation (inch)"),
149
  gr.Slider(minimum=0, maximum=100, value=50, label="Humidity (%)")
150
  ]
 
186
  gr.Markdown("### Input Parameters")
187
  for inp in inputs:
188
  inp.render()
189
+ submit_button = gr.Button(value="Submit", variant="primary")
190
+ clear_button = gr.Button(value="Clear")
 
 
 
191
 
192
  with gr.Column(scale=1):
193
  gr.Image(image_path)
194
 
195
+ # Bottom Section: Outputs (Three columns)
196
  with gr.Row():
197
  with gr.Column(scale=2):
198
  gr.Markdown("### Contamination Predictions")
 
211
 
212
  # Graph below the outputs
213
  with gr.Row():
214
+ plot_output = gr.Plot(label="Contamination Levels Over Time")
215
+
216
+ submit_button.click(
217
+ fn=predict_and_plot,
218
+ inputs=inputs,
219
+ outputs=[plot_output] + contamination_outputs + gradients_outputs + cleaning_time_outputs
220
+ )
221
+ clear_button.click(fn=lambda: None)
222
 
223
  demo.launch()