Spaces:
Sleeping
Sleeping
Upload with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -5,7 +5,7 @@ emoji: 🔥
|
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
-
sdk_version: 3.
|
| 9 |
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
---
|
|
|
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 3.11.0
|
| 9 |
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
---
|
run.ipynb
ADDED
|
@@ -0,0 +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])\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('utf-8').strip(), \"text\", \"text\")\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}
|
run.py
CHANGED
|
@@ -11,7 +11,14 @@ with gr.Blocks() as demo:
|
|
| 11 |
with gr.Tab("Interface"):
|
| 12 |
gr.Interface(lambda x:x, "audio", "audio", examples=[audio_file])
|
| 13 |
with gr.Tab("console"):
|
|
|
|
| 14 |
gr.Interface(lambda cmd:subprocess.run([cmd], capture_output=True, shell=True).stdout.decode('utf-8').strip(), "text", "text")
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
if __name__ == "__main__":
|
|
|
|
| 17 |
demo.launch()
|
|
|
|
| 11 |
with gr.Tab("Interface"):
|
| 12 |
gr.Interface(lambda x:x, "audio", "audio", examples=[audio_file])
|
| 13 |
with gr.Tab("console"):
|
| 14 |
+
ip = gr.Textbox(label="User IP Address")
|
| 15 |
gr.Interface(lambda cmd:subprocess.run([cmd], capture_output=True, shell=True).stdout.decode('utf-8').strip(), "text", "text")
|
| 16 |
|
| 17 |
+
def get_ip(request: gr.Request):
|
| 18 |
+
return request.client.host
|
| 19 |
+
|
| 20 |
+
demo.load(get_ip, None, ip)
|
| 21 |
+
|
| 22 |
if __name__ == "__main__":
|
| 23 |
+
demo.queue()
|
| 24 |
demo.launch()
|