mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-24 10:54:04 +08:00
10951105b8
* Update run.py * replace all np.random.random with new generator code * notebooks --------- Co-authored-by: aroffe99 <ari.roffe@morningstar.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
22 lines
496 B
Python
22 lines
496 B
Python
import gradio as gr
|
|
import numpy as np
|
|
import time
|
|
|
|
def fake_diffusion(steps):
|
|
rng = np.random.default_rng()
|
|
for i in range(steps):
|
|
time.sleep(1)
|
|
image = rng.random(size=(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()
|