abhishekkr commited on
Commit
1484848
1 Parent(s): e57b36c

Update app.py for slider to only have int values so range doesn't fail

Browse files

I tried this demo on Gradio Docs and the run failed for me, when I tweaked slider value.

Cause was default increment allows float values and `range(steps)` fails for float values. Thus solving it in Gradio's idiomatic way... adding `step=1` to *Slider* would only allow steps:int to be used. Avoiding error scenarios.

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -13,7 +13,7 @@ def fake_diffusion(steps):
13
  yield image
14
 
15
  demo = gr.Interface(fake_diffusion,
16
- inputs=gr.Slider(1, 10, 3),
17
  outputs="image")
18
 
19
  # define queue - required for generators
 
13
  yield image
14
 
15
  demo = gr.Interface(fake_diffusion,
16
+ inputs=gr.Slider(1, 10, 3, step=1),
17
  outputs="image")
18
 
19
  # define queue - required for generators