Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.35.2
|
| 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: annotatedimage_component_main
|
| 4 |
+
emoji: 🔥
|
| 5 |
+
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
sdk_version: 3.35.2
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
---
|
|
|
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
https://gradio-main-build.s3.amazonaws.com/c7081e5747b941a3dc0018b3216d62ac41e17dd4/gradio-3.35.2-py3-none-any.whl
|
run.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: annotatedimage_component"]}, {"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": ["import gradio as gr\n", "import pathlib\n", "from PIL import Image\n", "import numpy as np\n", "import urllib.request\n", "\n", "\n", "source_dir = pathlib.Path(__file__).parent\n", "\n", "urllib.request.urlretrieve(\n", " 'https://gradio-builds.s3.amazonaws.com/demo-files/base.png',\n", " str(source_dir / \"base.png\")\n", ")\n", "urllib.request.urlretrieve(\n", " \"https://gradio-builds.s3.amazonaws.com/demo-files/buildings.png\",\n", " str(source_dir / \"buildings.png\")\n", ")\n", "\n", "base_image = Image.open(str(source_dir / \"base.png\"))\n", "building_image = Image.open(str(source_dir / \"buildings.png\"))\n", "\n", "# Create segmentation mask\n", "building_image = np.asarray(building_image)[:, :, -1] > 0\n", "\n", "css = \"footer {display: none !important;} .gradio-container {min-height: 0px !important;}\"\n", "\n", "with gr.Blocks(css=css) as demo:\n", " gr.AnnotatedImage(\n", " value=(base_image, [(building_image, \"buildings\")]),\n", " height=500,\n", " )\n", "\n", "demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pathlib
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import numpy as np
|
| 5 |
+
import urllib.request
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
source_dir = pathlib.Path(__file__).parent
|
| 9 |
+
|
| 10 |
+
urllib.request.urlretrieve(
|
| 11 |
+
'https://gradio-builds.s3.amazonaws.com/demo-files/base.png',
|
| 12 |
+
str(source_dir / "base.png")
|
| 13 |
+
)
|
| 14 |
+
urllib.request.urlretrieve(
|
| 15 |
+
"https://gradio-builds.s3.amazonaws.com/demo-files/buildings.png",
|
| 16 |
+
str(source_dir / "buildings.png")
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
base_image = Image.open(str(source_dir / "base.png"))
|
| 20 |
+
building_image = Image.open(str(source_dir / "buildings.png"))
|
| 21 |
+
|
| 22 |
+
# Create segmentation mask
|
| 23 |
+
building_image = np.asarray(building_image)[:, :, -1] > 0
|
| 24 |
+
|
| 25 |
+
css = "footer {display: none !important;} .gradio-container {min-height: 0px !important;}"
|
| 26 |
+
|
| 27 |
+
with gr.Blocks(css=css) as demo:
|
| 28 |
+
gr.AnnotatedImage(
|
| 29 |
+
value=(base_image, [(building_image, "buildings")]),
|
| 30 |
+
height=500,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
demo.launch()
|