Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
title: show_progress_on
|
| 4 |
+
emoji: 🔥
|
| 5 |
+
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 6.0.0
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
+
hf_oauth: true
|
| 12 |
---
|
|
|
|
|
|
run.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: show_progress_on"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["# This demo needs to be run from the repo folder.\n", "# python demo/fake_gan/run.py\n", "import time\n", "import gradio as gr\n", "from gradio.media import get_image\n", "\n", "def fake_gan():\n", " time.sleep(5)\n", " images = [\n", " (get_image(\"cheetah.jpg\"), f\"label {i}\")\n", " for i in range(3)\n", " ]\n", " return images, \"Done\"\n", "\n", "with gr.Blocks() as demo:\n", " gallery = gr.Gallery(\n", " label=\"Generated images\", show_label=False, elem_id=\"gallery\"\n", " , columns=1, object_fit=\"contain\", height=\"auto\")\n", " t = gr.Textbox(label=\"Progress\", elem_id=\"progress_textbox\")\n", " btn = gr.Button(\"Generate images\", scale=0)\n", "\n", " btn.click(fake_gan, None, [gallery, t], show_progress=\"minimal\", show_progress_on=t)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This demo needs to be run from the repo folder.
|
| 2 |
+
# python demo/fake_gan/run.py
|
| 3 |
+
import time
|
| 4 |
+
import gradio as gr
|
| 5 |
+
from gradio.media import get_image
|
| 6 |
+
|
| 7 |
+
def fake_gan():
|
| 8 |
+
time.sleep(5)
|
| 9 |
+
images = [
|
| 10 |
+
(get_image("cheetah.jpg"), f"label {i}")
|
| 11 |
+
for i in range(3)
|
| 12 |
+
]
|
| 13 |
+
return images, "Done"
|
| 14 |
+
|
| 15 |
+
with gr.Blocks() as demo:
|
| 16 |
+
gallery = gr.Gallery(
|
| 17 |
+
label="Generated images", show_label=False, elem_id="gallery"
|
| 18 |
+
, columns=1, object_fit="contain", height="auto")
|
| 19 |
+
t = gr.Textbox(label="Progress", elem_id="progress_textbox")
|
| 20 |
+
btn = gr.Button("Generate images", scale=0)
|
| 21 |
+
|
| 22 |
+
btn.click(fake_gan, None, [gallery, t], show_progress="minimal", show_progress_on=t)
|
| 23 |
+
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
demo.launch()
|