Upload folder using huggingface_hub
Browse files
run.ipynb
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: waveform"]}, {"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 random\n", "\n", "
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: waveform"]}, {"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 random\n", "\n", "COLORS = [\n", " [\"#ff0000\", \"#00ff00\"],\n", " [\"#00ff00\", \"#0000ff\"],\n", " [\"#0000ff\", \"#ff0000\"],\n", "]\n", "\n", "def audio_waveform(audio, image):\n", " return (\n", " audio,\n", " gr.make_waveform(audio),\n", " gr.make_waveform(audio, animate=True),\n", " gr.make_waveform(audio, bg_image=image, bars_color=str(random.choice(COLORS))),\n", " )\n", "\n", "gr.Interface(\n", " audio_waveform,\n", " inputs=[gr.Audio(), gr.Image(type=\"filepath\")],\n", " outputs=[\n", " gr.Audio(),\n", " gr.Video(),\n", " gr.Video(),\n", " gr.Video(),\n", " ],\n", ").launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
|
| 4 |
-
|
| 5 |
COLORS = [
|
| 6 |
["#ff0000", "#00ff00"],
|
| 7 |
["#00ff00", "#0000ff"],
|
| 8 |
["#0000ff", "#ff0000"],
|
| 9 |
-
]
|
| 10 |
|
| 11 |
def audio_waveform(audio, image):
|
| 12 |
return (
|
|
@@ -16,7 +15,6 @@ def audio_waveform(audio, image):
|
|
| 16 |
gr.make_waveform(audio, bg_image=image, bars_color=str(random.choice(COLORS))),
|
| 17 |
)
|
| 18 |
|
| 19 |
-
|
| 20 |
gr.Interface(
|
| 21 |
audio_waveform,
|
| 22 |
inputs=[gr.Audio(), gr.Image(type="filepath")],
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
|
|
|
|
| 4 |
COLORS = [
|
| 5 |
["#ff0000", "#00ff00"],
|
| 6 |
["#00ff00", "#0000ff"],
|
| 7 |
["#0000ff", "#ff0000"],
|
| 8 |
+
]
|
| 9 |
|
| 10 |
def audio_waveform(audio, image):
|
| 11 |
return (
|
|
|
|
| 15 |
gr.make_waveform(audio, bg_image=image, bars_color=str(random.choice(COLORS))),
|
| 16 |
)
|
| 17 |
|
|
|
|
| 18 |
gr.Interface(
|
| 19 |
audio_waveform,
|
| 20 |
inputs=[gr.Audio(), gr.Image(type="filepath")],
|