Spaces:
Sleeping
Sleeping
gradio-pr-bot
commited on
Commit
•
d649c18
1
Parent(s):
7b0566a
Upload folder using huggingface_hub
Browse files- demos/audio_debugger/run.ipynb +1 -1
- demos/audio_debugger/run.py +20 -6
- requirements.txt +2 -2
demos/audio_debugger/run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: audio_debugger"]}, {"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/audio_debugger/cantina.wav"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import subprocess\n", "import os\n", "\n", "audio_file = os.path.join(os.path.abspath(''), \"cantina.wav\")\n", "\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Tab(\"Audio\"):\n", " gr.Audio(audio_file)\n", " with gr.Tab(\"Interface\"):\n", " gr.Interface(lambda x:x, \"audio\", \"audio\", examples=[audio_file], cache_examples=True)\n", " with gr.Tab(\"Streaming\"):\n", " gr.Interface(lambda x:x, gr.Audio(streaming=True), \"audio\", examples=[audio_file], cache_examples=True)\n", " with gr.Tab(\"console\"):\n", " ip = gr.Textbox(label=\"User IP Address\")\n", " gr.Interface(lambda cmd:subprocess.run([cmd], capture_output=True, shell=True).stdout.decode(
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: audio_debugger"]}, {"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/audio_debugger/cantina.wav"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import subprocess\n", "import os\n", "\n", "audio_file = os.path.join(os.path.abspath(''), \"cantina.wav\")\n", "\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Tab(\"Audio\"):\n", " gr.Audio(audio_file)\n", " with gr.Tab(\"Interface\"):\n", " gr.Interface(\n", " lambda x: x, \"audio\", \"audio\", examples=[audio_file], cache_examples=True\n", " )\n", " with gr.Tab(\"Streaming\"):\n", " gr.Interface(\n", " lambda x: x,\n", " gr.Audio(streaming=True),\n", " \"audio\",\n", " examples=[audio_file],\n", " cache_examples=True,\n", " )\n", " with gr.Tab(\"console\"):\n", " ip = gr.Textbox(label=\"User IP Address\")\n", " gr.Interface(\n", " lambda cmd: subprocess.run([cmd], capture_output=True, shell=True)\n", " .stdout.decode(\"utf-8\")\n", " .strip(),\n", " \"text\",\n", " \"text\",\n", " )\n", "\n", " def get_ip(request: gr.Request):\n", " return request.client.host\n", "\n", " demo.load(get_ip, None, ip)\n", "\n", "if __name__ == \"__main__\":\n", " demo.queue()\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/audio_debugger/run.py
CHANGED
@@ -9,18 +9,32 @@ with gr.Blocks() as demo:
|
|
9 |
with gr.Tab("Audio"):
|
10 |
gr.Audio(audio_file)
|
11 |
with gr.Tab("Interface"):
|
12 |
-
gr.Interface(
|
|
|
|
|
13 |
with gr.Tab("Streaming"):
|
14 |
-
gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
with gr.Tab("console"):
|
16 |
ip = gr.Textbox(label="User IP Address")
|
17 |
-
gr.Interface(
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def get_ip(request: gr.Request):
|
20 |
return request.client.host
|
21 |
-
|
22 |
demo.load(get_ip, None, ip)
|
23 |
-
|
24 |
if __name__ == "__main__":
|
25 |
demo.queue()
|
26 |
demo.launch()
|
|
|
9 |
with gr.Tab("Audio"):
|
10 |
gr.Audio(audio_file)
|
11 |
with gr.Tab("Interface"):
|
12 |
+
gr.Interface(
|
13 |
+
lambda x: x, "audio", "audio", examples=[audio_file], cache_examples=True
|
14 |
+
)
|
15 |
with gr.Tab("Streaming"):
|
16 |
+
gr.Interface(
|
17 |
+
lambda x: x,
|
18 |
+
gr.Audio(streaming=True),
|
19 |
+
"audio",
|
20 |
+
examples=[audio_file],
|
21 |
+
cache_examples=True,
|
22 |
+
)
|
23 |
with gr.Tab("console"):
|
24 |
ip = gr.Textbox(label="User IP Address")
|
25 |
+
gr.Interface(
|
26 |
+
lambda cmd: subprocess.run([cmd], capture_output=True, shell=True)
|
27 |
+
.stdout.decode("utf-8")
|
28 |
+
.strip(),
|
29 |
+
"text",
|
30 |
+
"text",
|
31 |
+
)
|
32 |
+
|
33 |
def get_ip(request: gr.Request):
|
34 |
return request.client.host
|
35 |
+
|
36 |
demo.load(get_ip, None, ip)
|
37 |
+
|
38 |
if __name__ == "__main__":
|
39 |
demo.queue()
|
40 |
demo.launch()
|
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@08d5d62880975ebee9b4986395919a306e28030b#subdirectory=client/python
|
3 |
+
https://gradio-builds.s3.amazonaws.com/08d5d62880975ebee9b4986395919a306e28030b/gradio-4.21.0-py3-none-any.whl
|
4 |
pypistats==1.1.0
|
5 |
plotly==5.10.0
|
6 |
opencv-python==4.6.0.66
|