aliabd HF staff commited on
Commit
350c49b
1 Parent(s): 34cb911

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +22 -0
README.md CHANGED
@@ -6,6 +6,7 @@ colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
- app_file: run.py
 
10
  pinned: false
11
  ---
 
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
+
10
+ app_file: app.py
11
  pinned: false
12
  ---
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import time
4
+
5
+ # define core fn, which returns a generator {steps} times before returning the image
6
+ def fake_diffusion(steps):
7
+ for _ in range(steps):
8
+ time.sleep(1)
9
+ image = np.random.random((600, 600, 3))
10
+ yield image
11
+
12
+ image = "https://i.picsum.photos/id/867/600/600.jpg?hmac=qE7QFJwLmlE_WKI7zMH6SgH5iY5fx8ec6ZJQBwKRT44"
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
20
+ demo.queue()
21
+
22
+ demo.launch()