Spaces:
Sleeping
Sleeping
gradio-pr-bot
commited on
Commit
•
440a698
1
Parent(s):
48c40d6
Upload folder using huggingface_hub
Browse files- README.md +1 -1
- demos/chatinterface_streaming_echo/run.ipynb +1 -1
- demos/chatinterface_streaming_echo/run.py +3 -1
- demos/fake_diffusion_with_gif/run.ipynb +1 -1
- demos/fake_diffusion_with_gif/run.py +2 -1
- demos/file_explorer_component_events/dir1/bar.txt +0 -0
- demos/file_explorer_component_events/dir1/foo.txt +0 -0
- demos/file_explorer_component_events/dir2/baz.png +0 -0
- demos/file_explorer_component_events/dir2/foo.png +0 -0
- demos/file_explorer_component_events/dir3/dir3_bar.log +0 -0
- demos/file_explorer_component_events/dir3/dir3_foo.txt +0 -0
- demos/file_explorer_component_events/dir3/dir4/dir5/dir5_foo.txt +0 -0
- demos/file_explorer_component_events/dir3/dir4/dir7/dir7_foo.txt +0 -0
- demos/file_explorer_component_events/dir3/dir4/dir_4_bar.log +0 -0
- demos/file_explorer_component_events/dir3/dir4/dir_4_foo.txt +0 -0
- demos/file_explorer_component_events/run.ipynb +1 -0
- demos/file_explorer_component_events/run.py +35 -0
- demos/model3D/run.ipynb +1 -1
- demos/model3D/run.py +2 -0
- demos/stt_or_tts/run.ipynb +1 -1
- demos/stt_or_tts/run.py +1 -2
- requirements.txt +2 -2
README.md
CHANGED
@@ -5,7 +5,7 @@ emoji: 💩
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
-
sdk_version: 4.
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
---
|
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 4.19.0
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
---
|
demos/chatinterface_streaming_echo/run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_streaming_echo"]}, {"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 time\n", "import gradio as gr\n", "\n", "def slow_echo(message, history):\n", " for i in range(len(message)):\n", " time.sleep(0.05)\n", " yield \"You typed: \" + message[: i+1]\n", "\n", "demo = gr.ChatInterface(slow_echo).queue()\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: chatinterface_streaming_echo"]}, {"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 time\n", "import gradio as gr\n", "\n", "\n", "def slow_echo(message, history):\n", " for i in range(len(message)):\n", " time.sleep(0.05)\n", " yield \"You typed: \" + message[: i + 1]\n", "\n", "\n", "demo = gr.ChatInterface(slow_echo).queue()\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/chatinterface_streaming_echo/run.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
import time
|
2 |
import gradio as gr
|
3 |
|
|
|
4 |
def slow_echo(message, history):
|
5 |
for i in range(len(message)):
|
6 |
time.sleep(0.05)
|
7 |
-
yield "You typed: " + message[: i+1]
|
|
|
8 |
|
9 |
demo = gr.ChatInterface(slow_echo).queue()
|
10 |
|
|
|
1 |
import time
|
2 |
import gradio as gr
|
3 |
|
4 |
+
|
5 |
def slow_echo(message, history):
|
6 |
for i in range(len(message)):
|
7 |
time.sleep(0.05)
|
8 |
+
yield "You typed: " + message[: i + 1]
|
9 |
+
|
10 |
|
11 |
demo = gr.ChatInterface(slow_echo).queue()
|
12 |
|
demos/fake_diffusion_with_gif/run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: fake_diffusion_with_gif"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/fake_diffusion_with_gif/image.gif"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import numpy as np\n", "import time\n", "import os\n", "from PIL import Image\n", "import requests\n", "from io import BytesIO\n", "\n", "\n", "def create_gif(images):\n", " pil_images = []\n", " for image in images:\n", " if isinstance(image, str):\n", " response = requests.get(image)\n", " image = Image.open(BytesIO(response.content))\n", " else:\n", " image = Image.fromarray((image * 255).astype(np.uint8))\n", " pil_images.append(image)\n", " fp_out = os.path.join(os.path.abspath(''), \"image.gif\")\n", " img = pil_images.pop(0)\n", " img.save(fp=fp_out, format='GIF', append_images=pil_images,\n", " save_all=True, duration=400, loop=0)\n", " return fp_out\n", "\n", "\n", "def fake_diffusion(steps):\n", " images = []\n", " for _ in range(steps):\n", " time.sleep(1)\n", " image =
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: fake_diffusion_with_gif"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/fake_diffusion_with_gif/image.gif"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import numpy as np\n", "import time\n", "import os\n", "from PIL import Image\n", "import requests\n", "from io import BytesIO\n", "\n", "\n", "def create_gif(images):\n", " pil_images = []\n", " for image in images:\n", " if isinstance(image, str):\n", " response = requests.get(image)\n", " image = Image.open(BytesIO(response.content))\n", " else:\n", " image = Image.fromarray((image * 255).astype(np.uint8))\n", " pil_images.append(image)\n", " fp_out = os.path.join(os.path.abspath(''), \"image.gif\")\n", " img = pil_images.pop(0)\n", " img.save(fp=fp_out, format='GIF', append_images=pil_images,\n", " save_all=True, duration=400, loop=0)\n", " return fp_out\n", "\n", "\n", "def fake_diffusion(steps):\n", " rng = np.random.default_rng()\n", " images = []\n", " for _ in range(steps):\n", " time.sleep(1)\n", " image = rng.random((600, 600, 3))\n", " images.append(image)\n", " yield image, gr.Image(visible=False)\n", "\n", " time.sleep(1)\n", " image = \"https://gradio-builds.s3.amazonaws.com/diffusion_image/cute_dog.jpg\"\n", " images.append(image)\n", " gif_path = create_gif(images)\n", "\n", " yield image, gr.Image(value=gif_path, visible=True)\n", "\n", "\n", "demo = gr.Interface(fake_diffusion,\n", " inputs=gr.Slider(1, 10, 3, step=1),\n", " outputs=[\"image\", gr.Image(label=\"All Images\", visible=False)])\n", "demo.queue()\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/fake_diffusion_with_gif/run.py
CHANGED
@@ -24,10 +24,11 @@ def create_gif(images):
|
|
24 |
|
25 |
|
26 |
def fake_diffusion(steps):
|
|
|
27 |
images = []
|
28 |
for _ in range(steps):
|
29 |
time.sleep(1)
|
30 |
-
image =
|
31 |
images.append(image)
|
32 |
yield image, gr.Image(visible=False)
|
33 |
|
|
|
24 |
|
25 |
|
26 |
def fake_diffusion(steps):
|
27 |
+
rng = np.random.default_rng()
|
28 |
images = []
|
29 |
for _ in range(steps):
|
30 |
time.sleep(1)
|
31 |
+
image = rng.random((600, 600, 3))
|
32 |
images.append(image)
|
33 |
yield image, gr.Image(visible=False)
|
34 |
|
demos/file_explorer_component_events/dir1/bar.txt
ADDED
File without changes
|
demos/file_explorer_component_events/dir1/foo.txt
ADDED
File without changes
|
demos/file_explorer_component_events/dir2/baz.png
ADDED
demos/file_explorer_component_events/dir2/foo.png
ADDED
demos/file_explorer_component_events/dir3/dir3_bar.log
ADDED
File without changes
|
demos/file_explorer_component_events/dir3/dir3_foo.txt
ADDED
File without changes
|
demos/file_explorer_component_events/dir3/dir4/dir5/dir5_foo.txt
ADDED
File without changes
|
demos/file_explorer_component_events/dir3/dir4/dir7/dir7_foo.txt
ADDED
File without changes
|
demos/file_explorer_component_events/dir3/dir4/dir_4_bar.log
ADDED
File without changes
|
demos/file_explorer_component_events/dir3/dir4/dir_4_foo.txt
ADDED
File without changes
|
demos/file_explorer_component_events/run.ipynb
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: file_explorer_component_events"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "os.mkdir('dir1')\n", "!wget -q -O dir1/bar.txt https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir1/bar.txt\n", "!wget -q -O dir1/foo.txt https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir1/foo.txt\n", "os.mkdir('dir2')\n", "!wget -q -O dir2/baz.png https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir2/baz.png\n", "!wget -q -O dir2/foo.png https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir2/foo.png\n", "os.mkdir('dir3')\n", "!wget -q -O dir3/dir3_bar.log https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir3/dir3_bar.log\n", "!wget -q -O dir3/dir3_foo.txt https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir3/dir3_foo.txt\n", "!wget -q -O dir3/dir4 https://github.com/gradio-app/gradio/raw/main/demo/file_explorer_component_events/dir3/dir4"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "from pathlib import Path\n", "\n", "base_root = Path(__file__).parent.resolve()\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Row():\n", " dd = gr.Dropdown(label=\"Select File Explorer Root\",\n", " value=str(base_root / \"dir1\"),\n", " choices=[str(base_root / \"dir1\"), str(base_root / \"dir2\"),\n", " str(base_root / \"dir3\")])\n", " with gr.Group():\n", " txt_only_glob = gr.Checkbox(label=\"Show only text files\", value=False)\n", " ignore_txt_in_glob = gr.Checkbox(label=\"Ignore text files in glob\", value=False)\n", "\n", " fe = gr.FileExplorer(root_dir=str(base_root / \"dir1\"),\n", " glob=\"**/*\", interactive=True)\n", " textbox = gr.Textbox(label=\"Selected Directory\")\n", " run = gr.Button(\"Run\")\n", " \n", " txt_only_glob.select(lambda s: gr.FileExplorer(glob=\"*.txt\" if s else \"*\") ,\n", " inputs=[txt_only_glob], outputs=[fe])\n", " ignore_txt_in_glob.select(lambda s: gr.FileExplorer(ignore_glob=\"*.txt\" if s else None),\n", " inputs=[ignore_txt_in_glob], outputs=[fe]) \n", "\n", " dd.select(lambda s: gr.FileExplorer(root=s), inputs=[dd], outputs=[fe])\n", " run.click(lambda s: \",\".join(s) if isinstance(s, list) else s, inputs=[fe], outputs=[textbox])\n", "\n", " with gr.Row():\n", " a = gr.Textbox(elem_id=\"input-box\")\n", " a.change(lambda x: x, inputs=[a])\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/file_explorer_component_events/run.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from pathlib import Path
|
3 |
+
|
4 |
+
base_root = Path(__file__).parent.resolve()
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with gr.Row():
|
8 |
+
dd = gr.Dropdown(label="Select File Explorer Root",
|
9 |
+
value=str(base_root / "dir1"),
|
10 |
+
choices=[str(base_root / "dir1"), str(base_root / "dir2"),
|
11 |
+
str(base_root / "dir3")])
|
12 |
+
with gr.Group():
|
13 |
+
txt_only_glob = gr.Checkbox(label="Show only text files", value=False)
|
14 |
+
ignore_txt_in_glob = gr.Checkbox(label="Ignore text files in glob", value=False)
|
15 |
+
|
16 |
+
fe = gr.FileExplorer(root_dir=str(base_root / "dir1"),
|
17 |
+
glob="**/*", interactive=True)
|
18 |
+
textbox = gr.Textbox(label="Selected Directory")
|
19 |
+
run = gr.Button("Run")
|
20 |
+
|
21 |
+
txt_only_glob.select(lambda s: gr.FileExplorer(glob="*.txt" if s else "*") ,
|
22 |
+
inputs=[txt_only_glob], outputs=[fe])
|
23 |
+
ignore_txt_in_glob.select(lambda s: gr.FileExplorer(ignore_glob="*.txt" if s else None),
|
24 |
+
inputs=[ignore_txt_in_glob], outputs=[fe])
|
25 |
+
|
26 |
+
dd.select(lambda s: gr.FileExplorer(root=s), inputs=[dd], outputs=[fe])
|
27 |
+
run.click(lambda s: ",".join(s) if isinstance(s, list) else s, inputs=[fe], outputs=[textbox])
|
28 |
+
|
29 |
+
with gr.Row():
|
30 |
+
a = gr.Textbox(elem_id="input-box")
|
31 |
+
a.change(lambda x: x, inputs=[a])
|
32 |
+
|
33 |
+
|
34 |
+
if __name__ == "__main__":
|
35 |
+
demo.launch()
|
demos/model3D/run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: model3D"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "os.mkdir('files')\n", "!wget -q -O files/Bunny.obj https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Bunny.obj\n", "!wget -q -O files/Duck.glb https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Duck.glb\n", "!wget -q -O files/Fox.gltf https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Fox.gltf\n", "!wget -q -O files/face.obj https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/face.obj\n", "!wget -q -O files/sofia.stl https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/sofia.stl\n", "!wget -q -O files/source.txt https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/source.txt"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "\n", "\n", "def load_mesh(mesh_file_name):\n", " return mesh_file_name\n", "\n", "\n", "demo = gr.Interface(\n", " fn=load_mesh,\n", " inputs=gr.Model3D(),\n", " outputs=gr.Model3D(\n", " clear_color=[0.0, 0.0, 0.0, 0.0], label=\"3D Model\"),\n", " examples=[\n", " [os.path.join(os.path.abspath(''), \"files/Bunny.obj\")],\n", " [os.path.join(os.path.abspath(''), \"files/Duck.glb\")],\n", " [os.path.join(os.path.abspath(''), \"files/Fox.gltf\")],\n", " [os.path.join(os.path.abspath(''), \"files/face.obj\")],\n", " [os.path.join(os.path.abspath(''), \"files/sofia.stl\")],\n", " ],\n", " cache_examples=True\n", ")\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: model3D"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "os.mkdir('files')\n", "!wget -q -O files/Bunny.obj https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Bunny.obj\n", "!wget -q -O files/Duck.glb https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Duck.glb\n", "!wget -q -O files/Fox.gltf https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Fox.gltf\n", "!wget -q -O files/face.obj https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/face.obj\n", "!wget -q -O files/sofia.stl https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/sofia.stl\n", "!wget -q -O files/source.txt https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/source.txt"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "\n", "\n", "def load_mesh(mesh_file_name):\n", " return mesh_file_name\n", "\n", "\n", "demo = gr.Interface(\n", " fn=load_mesh,\n", " inputs=gr.Model3D(),\n", " outputs=gr.Model3D(\n", " clear_color=[0.0, 0.0, 0.0, 0.0], label=\"3D Model\"),\n", " examples=[\n", " [os.path.join(os.path.abspath(''), \"files/Bunny.obj\")],\n", " [os.path.join(os.path.abspath(''), \"files/Duck.glb\")],\n", " [os.path.join(os.path.abspath(''), \"files/Fox.gltf\")],\n", " [os.path.join(os.path.abspath(''), \"files/face.obj\")],\n", " [os.path.join(os.path.abspath(''), \"files/sofia.stl\")],\n", " [\"https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k-mini.splat\"],\n", " [\"https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/luigi/luigi.ply\"],\n", " ],\n", " cache_examples=True\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/model3D/run.py
CHANGED
@@ -17,6 +17,8 @@ demo = gr.Interface(
|
|
17 |
[os.path.join(os.path.dirname(__file__), "files/Fox.gltf")],
|
18 |
[os.path.join(os.path.dirname(__file__), "files/face.obj")],
|
19 |
[os.path.join(os.path.dirname(__file__), "files/sofia.stl")],
|
|
|
|
|
20 |
],
|
21 |
cache_examples=True
|
22 |
)
|
|
|
17 |
[os.path.join(os.path.dirname(__file__), "files/Fox.gltf")],
|
18 |
[os.path.join(os.path.dirname(__file__), "files/face.obj")],
|
19 |
[os.path.join(os.path.dirname(__file__), "files/sofia.stl")],
|
20 |
+
["https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k-mini.splat"],
|
21 |
+
["https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/luigi/luigi.ply"],
|
22 |
],
|
23 |
cache_examples=True
|
24 |
)
|
demos/stt_or_tts/run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: stt_or_tts"]}, {"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", "\n", "tts_examples = [\n", " \"I love learning machine learning\",\n", " \"How do you do?\",\n", "]\n", "\n", "tts_demo = gr.load(\n", " \"huggingface/facebook/fastspeech2-en-ljspeech\",\n", " title=None,\n", " examples=tts_examples,\n", " description=\"Give me something to say!\",\n", "
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: stt_or_tts"]}, {"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", "\n", "tts_examples = [\n", " \"I love learning machine learning\",\n", " \"How do you do?\",\n", "]\n", "\n", "tts_demo = gr.load(\n", " \"huggingface/facebook/fastspeech2-en-ljspeech\",\n", " title=None,\n", " examples=tts_examples,\n", " description=\"Give me something to say!\",\n", ")\n", "\n", "stt_demo = gr.load(\n", " \"huggingface/facebook/wav2vec2-base-960h\",\n", " title=None,\n", " inputs=gr.Microphone(type=\"filepath\"),\n", " description=\"Let me try to guess what you're saying!\",\n", ")\n", "\n", "demo = gr.TabbedInterface([tts_demo, stt_demo], [\"Text-to-speech\", \"Speech-to-text\"])\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/stt_or_tts/run.py
CHANGED
@@ -10,13 +10,12 @@ tts_demo = gr.load(
|
|
10 |
title=None,
|
11 |
examples=tts_examples,
|
12 |
description="Give me something to say!",
|
13 |
-
cache_examples=False
|
14 |
)
|
15 |
|
16 |
stt_demo = gr.load(
|
17 |
"huggingface/facebook/wav2vec2-base-960h",
|
18 |
title=None,
|
19 |
-
inputs="
|
20 |
description="Let me try to guess what you're saying!",
|
21 |
)
|
22 |
|
|
|
10 |
title=None,
|
11 |
examples=tts_examples,
|
12 |
description="Give me something to say!",
|
|
|
13 |
)
|
14 |
|
15 |
stt_demo = gr.load(
|
16 |
"huggingface/facebook/wav2vec2-base-960h",
|
17 |
title=None,
|
18 |
+
inputs=gr.Microphone(type="filepath"),
|
19 |
description="Let me try to guess what you're saying!",
|
20 |
)
|
21 |
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
|
2 |
-
gradio-client @ git+https://github.com/gradio-app/gradio@
|
3 |
-
https://gradio-builds.s3.amazonaws.com/
|
4 |
pypistats==1.1.0
|
5 |
plotly==5.10.0
|
6 |
opencv-python==4.6.0.66
|
|
|
1 |
|
2 |
+
gradio-client @ git+https://github.com/gradio-app/gradio@766f25ab18c1fa401296b17e779a3036ccc7729e#subdirectory=client/python
|
3 |
+
https://gradio-builds.s3.amazonaws.com/766f25ab18c1fa401296b17e779a3036ccc7729e/gradio-4.19.0-py3-none-any.whl
|
4 |
pypistats==1.1.0
|
5 |
plotly==5.10.0
|
6 |
opencv-python==4.6.0.66
|