aliabd HF staff commited on
Commit
2240393
1 Parent(s): e1dc298

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1,7 +1,10 @@
 
 
1
  import gradio as gr
2
  import numpy as np
3
  import time
4
 
 
5
  def fake_diffusion(steps):
6
  for _ in range(steps):
7
  time.sleep(1)
@@ -11,9 +14,13 @@ def fake_diffusion(steps):
11
  image = "https://i.picsum.photos/id/867/600/600.jpg?hmac=qE7QFJwLmlE_WKI7zMH6SgH5iY5fx8ec6ZJQBwKRT44"
12
  yield image
13
 
14
-
15
  demo = gr.Interface(fake_diffusion,
16
  inputs=gr.Slider(1, 10, 3),
17
  outputs="image")
 
 
18
  demo.queue()
 
 
19
  demo.launch()
 
1
+ # URL: https://huggingface.co/spaces/gradio/fake_diffusion
2
+ # imports
3
  import gradio as gr
4
  import numpy as np
5
  import time
6
 
7
+ # define core fn, which returns a generator {steps} times before returning the image
8
  def fake_diffusion(steps):
9
  for _ in range(steps):
10
  time.sleep(1)
 
14
  image = "https://i.picsum.photos/id/867/600/600.jpg?hmac=qE7QFJwLmlE_WKI7zMH6SgH5iY5fx8ec6ZJQBwKRT44"
15
  yield image
16
 
17
+ # define Interface
18
  demo = gr.Interface(fake_diffusion,
19
  inputs=gr.Slider(1, 10, 3),
20
  outputs="image")
21
+
22
+ # define queue - required for generators
23
  demo.queue()
24
+
25
+ # launch
26
  demo.launch()