Spaces:
Running
Running
abhishekkr
commited on
Update app.py for slider to only have int values so range doesn't fail
Browse filesI 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.
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
|