aliabd HF staff commited on
Commit
6dad6fd
1 Parent(s): e57b36c

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. run.ipynb +1 -1
  3. run.py +5 -2
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 4.14.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 4.27.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
run.ipynb CHANGED
@@ -1 +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", "def fake_diffusion(steps):\n", " for i in range(steps):\n", " time.sleep(1)\n", " image = np.random.random((600, 600, 3))\n", " yield image\n", " image = np.ones((1000,1000,3), np.uint8)\n", " image[:] = [255, 124, 0]\n", " yield image\n", "\n", "\n", "demo = gr.Interface(fake_diffusion, inputs=gr.Slider(1, 10, 3), outputs=\"image\")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
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", "def fake_diffusion(steps):\n", " rng = np.random.default_rng()\n", " for i in range(steps):\n", " time.sleep(1)\n", " image = rng.random(size=(600, 600, 3))\n", " yield image\n", " image = np.ones((1000,1000,3), np.uint8)\n", " image[:] = [255, 124, 0]\n", " yield image\n", "\n", "\n", "demo = gr.Interface(fake_diffusion,\n", " inputs=gr.Slider(1, 10, 3, step=1),\n", " outputs=\"image\")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -3,16 +3,19 @@ import numpy as np
3
  import time
4
 
5
  def fake_diffusion(steps):
 
6
  for i in range(steps):
7
  time.sleep(1)
8
- image = np.random.random((600, 600, 3))
9
  yield image
10
  image = np.ones((1000,1000,3), np.uint8)
11
  image[:] = [255, 124, 0]
12
  yield image
13
 
14
 
15
- demo = gr.Interface(fake_diffusion, inputs=gr.Slider(1, 10, 3), outputs="image")
 
 
16
 
17
  if __name__ == "__main__":
18
  demo.launch()
 
3
  import time
4
 
5
  def fake_diffusion(steps):
6
+ rng = np.random.default_rng()
7
  for i in range(steps):
8
  time.sleep(1)
9
+ image = rng.random(size=(600, 600, 3))
10
  yield image
11
  image = np.ones((1000,1000,3), np.uint8)
12
  image[:] = [255, 124, 0]
13
  yield image
14
 
15
 
16
+ demo = gr.Interface(fake_diffusion,
17
+ inputs=gr.Slider(1, 10, 3, step=1),
18
+ outputs="image")
19
 
20
  if __name__ == "__main__":
21
  demo.launch()