freddyaboulton HF staff aliabd HF staff commited on
Commit
fa6cad4
·
0 Parent(s):

Duplicate from gradio/fake_diffusion

Browse files

Co-authored-by: Ali Abdalla <aliabd@users.noreply.huggingface.co>

Files changed (7) hide show
  1. .gitattributes +31 -0
  2. DESCRIPTION.md +1 -0
  3. README.md +11 -0
  4. app.py +22 -0
  5. requirements.txt +1 -0
  6. run.ipynb +1 -0
  7. run.py +20 -0
.gitattributes ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.npy filter=lfs diff=lfs merge=lfs -text
13
+ *.npz filter=lfs diff=lfs merge=lfs -text
14
+ *.onnx filter=lfs diff=lfs merge=lfs -text
15
+ *.ot filter=lfs diff=lfs merge=lfs -text
16
+ *.parquet filter=lfs diff=lfs merge=lfs -text
17
+ *.pickle filter=lfs diff=lfs merge=lfs -text
18
+ *.pkl filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pt filter=lfs diff=lfs merge=lfs -text
21
+ *.pth filter=lfs diff=lfs merge=lfs -text
22
+ *.rar filter=lfs diff=lfs merge=lfs -text
23
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
24
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
25
+ *.tflite filter=lfs diff=lfs merge=lfs -text
26
+ *.tgz filter=lfs diff=lfs merge=lfs -text
27
+ *.wasm filter=lfs diff=lfs merge=lfs -text
28
+ *.xz filter=lfs diff=lfs merge=lfs -text
29
+ *.zip filter=lfs diff=lfs merge=lfs -text
30
+ *.zst filter=lfs diff=lfs merge=lfs -text
31
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
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 ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: fake_diffusion
3
+ emoji: 🔥
4
+ colorFrom: indigo
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 3.23.0
8
+ app_file: run.py
9
+ pinned: false
10
+ duplicated_from: gradio/fake_diffusion
11
+ ---
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()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ numpy
run.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: fake_diffusion\n", "### 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.\n", " "]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio numpy "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import numpy as np\n", "import time\n", "\n", "# define core fn, which returns a generator {steps} times before returning the image\n", "def fake_diffusion(steps):\n", " for _ in range(steps):\n", " time.sleep(1)\n", " image = np.random.random((600, 600, 3))\n", " yield image\n", " image = \"https://gradio-builds.s3.amazonaws.com/diffusion_image/cute_dog.jpg\"\n", " yield image\n", "\n", "\n", "demo = gr.Interface(fake_diffusion, inputs=gr.Slider(1, 10, 3), outputs=\"image\")\n", "\n", "# define queue - required for generators\n", "demo.queue()\n", "\n", "demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ image = "https://gradio-builds.s3.amazonaws.com/diffusion_image/cute_dog.jpg"
12
+ yield image
13
+
14
+
15
+ demo = gr.Interface(fake_diffusion, inputs=gr.Slider(1, 10, 3), outputs="image")
16
+
17
+ # define queue - required for generators
18
+ demo.queue()
19
+
20
+ demo.launch()