mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-05 11:10:03 +08:00
da4c46c33a
* Change image url : * Fix demos * CHANGELOG * Use s3 link
21 lines
532 B
Python
21 lines
532 B
Python
import gradio as gr
|
|
import numpy as np
|
|
import time
|
|
|
|
# define core fn, which returns a generator {steps} times before returning the image
|
|
def fake_diffusion(steps):
|
|
for _ in range(steps):
|
|
time.sleep(1)
|
|
image = np.random.random((600, 600, 3))
|
|
yield image
|
|
image = "https://gradio-builds.s3.amazonaws.com/diffusion_image/cute_dog.jpg"
|
|
yield image
|
|
|
|
|
|
demo = gr.Interface(fake_diffusion, inputs=gr.Slider(1, 10, 3), outputs="image")
|
|
|
|
# define queue - required for generators
|
|
demo.queue()
|
|
|
|
demo.launch()
|