aliabd commited on
Commit
339d939
·
1 Parent(s): 71755b4

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. DESCRIPTION.md +1 -0
  2. README.md +6 -7
  3. requirements.txt +2 -0
  4. run.py +22 -0
DESCRIPTION.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This demo uses a fake model to showcase iterative output. The Image output will update every time a generator is returned until the final image.
README.md CHANGED
@@ -1,12 +1,11 @@
 
1
  ---
2
- title: Fake Diffusion Main
3
- emoji: 🚀
4
- colorFrom: red
5
- colorTo: red
6
  sdk: gradio
7
  sdk_version: 3.6
8
- app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: fake_diffusion_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.6
9
+ app_file: run.py
10
  pinned: false
11
  ---
 
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ numpy
2
+ https://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
run.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()