Eachan Johnson commited on
Commit
9b5ec61
·
1 Parent(s): 7cf41a8

Make events sequential

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -311,7 +311,6 @@ with gr.Blocks() as demo:
311
  gr.Slider(label="Resistance-free half-life", info="Relative to start of clinical use",
312
  value=30., minimum=0., maximum=50., step=.2, scale=10),
313
  ]
314
- # refresh_button = gr.Button("Update plot", scale=6)
315
  fit_button = gr.Button("Fit parameters!", scale=6)
316
 
317
 
@@ -323,8 +322,12 @@ with gr.Blocks() as demo:
323
  )
324
  gr.on(
325
  triggers=[s.release for s in param_sliders],# + [refresh_button.click],
326
- fn=lambda *x: plot_data_altair(df=data, params=x),
327
  inputs=param_sliders,
 
 
 
 
328
  outputs=plot,
329
  )
330
 
@@ -352,7 +355,6 @@ with gr.Blocks() as demo:
352
  gr.Slider(label="🔮", info="In years",
353
  value=100., minimum=0., maximum=200., step=.5, scale=10),
354
  ]
355
- # refresh_button_forecast = gr.Button("Update plot", scale=6)
356
 
357
  param_and_forecast_sliders = param_sliders + forecast_sliders
358
  fit_message = gr.Markdown(forecast_msg, inputs=param_and_forecast_sliders)
@@ -362,8 +364,12 @@ with gr.Blocks() as demo:
362
  format="png",
363
  )
364
  gr.on(
365
- triggers=[s.release for s in param_and_forecast_sliders],# + [refresh_button_forecast.click, refresh_button.click],
366
- fn=lambda *x: plot_data_forecast_altair(df=data, params=x),
 
 
 
 
367
  inputs=param_and_forecast_sliders,
368
  outputs=forecast,
369
  )
 
311
  gr.Slider(label="Resistance-free half-life", info="Relative to start of clinical use",
312
  value=30., minimum=0., maximum=50., step=.2, scale=10),
313
  ]
 
314
  fit_button = gr.Button("Fit parameters!", scale=6)
315
 
316
 
 
322
  )
323
  gr.on(
324
  triggers=[s.release for s in param_sliders],# + [refresh_button.click],
325
+ fn=parameter_msg,
326
  inputs=param_sliders,
327
+ outputs=fit_message,
328
+ ).then(
329
+ lambda *x: plot_data_altair(df=data, params=x),
330
+ inputs=param_sliders,
331
  outputs=plot,
332
  )
333
 
 
355
  gr.Slider(label="🔮", info="In years",
356
  value=100., minimum=0., maximum=200., step=.5, scale=10),
357
  ]
 
358
 
359
  param_and_forecast_sliders = param_sliders + forecast_sliders
360
  fit_message = gr.Markdown(forecast_msg, inputs=param_and_forecast_sliders)
 
364
  format="png",
365
  )
366
  gr.on(
367
+ triggers=[s.release for s in param_and_forecast_sliders],
368
+ fn=forecast_msg,
369
+ inputs=param_and_forecast_sliders,
370
+ outputs=fit_message,
371
+ ).then(
372
+ lambda *x: plot_data_forecast_altair(df=data, params=x),
373
  inputs=param_and_forecast_sliders,
374
  outputs=forecast,
375
  )