gradio/demo/fake_diffusion/run.py
AbhishekKr 9949cdc850
Fix fake_diffusion demo by slider to only have int so range() doesn't fail (#7167)
Signed-off-by: AbhishekKr <abhikumar163@gmail.com>
2024-01-26 11:52:10 -05:00

21 lines
463 B
Python

import gradio as gr
import numpy as np
import time
def fake_diffusion(steps):
for i in range(steps):
time.sleep(1)
image = np.random.random((600, 600, 3))
yield image
image = np.ones((1000,1000,3), np.uint8)
image[:] = [255, 124, 0]
yield image
demo = gr.Interface(fake_diffusion,
inputs=gr.Slider(1, 10, 3, step=1),
outputs="image")
if __name__ == "__main__":
demo.launch()