mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-09 02:00:44 +08:00
bf1510165d
* Support for iterative outputs (#2162) (#2188) * added generator demo * fixed demo structure * fixes * fix failing tests due to refactor * test components * adding generators * fixes * iterative * formatting * add all * added demo * demo * formatting * fixed frontend * 3.2.1b release * removed test queue * iterative * formatting * formatting * Support for iterative outputs (#2149) * added generator demo * fixed demo structure * fixes * fix failing tests due to refactor * test components * adding generators * fixes * iterative * formatting * add all * added demo * demo * formatting * fixed frontend * 3.2.1b release * iterative * formatting * formatting * reverted queue everywhere * added queue to demos * added fake diffusion with gif * add to demos * more complex counter * fixes * image gif * fixes * version * merged * added support for state * formatting * generating animation * fix * tests, iterator * tests * formatting * tests for queuing * version * generating orange border animation * testings * added to documentation Co-authored-by: Ali Abid <aabid94@gmail.com>
23 lines
509 B
Python
23 lines
509 B
Python
import gradio as gr
|
|
import numpy as np
|
|
import time
|
|
|
|
|
|
def fake_diffusion(steps):
|
|
for _ in range(steps):
|
|
time.sleep(1)
|
|
image = np.random.random((600, 600, 3))
|
|
yield image
|
|
|
|
image = "https://i.picsum.photos/id/867/600/600.jpg?hmac=qE7QFJwLmlE_WKI7zMH6SgH5iY5fx8ec6ZJQBwKRT44"
|
|
yield image
|
|
|
|
|
|
demo = gr.Interface(fake_diffusion,
|
|
inputs=gr.Slider(1, 10, 3),
|
|
outputs="image")
|
|
demo.queue()
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|