aliabd commited on
Commit
b2d8d00
·
1 Parent(s): b665a07

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +7 -7
  2. gradio_cached_examples/test +0 -0
  3. run.ipynb +1 -0
  4. run.py +29 -0
README.md CHANGED
@@ -1,12 +1,12 @@
 
1
  ---
2
- title: Waveform 3-x
3
- emoji: 🐠
4
  colorFrom: indigo
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 4.3.0
8
- app_file: app.py
9
  pinned: false
 
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: waveform_3-x
4
+ emoji: 🔥
5
  colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 3.50.1
9
+ app_file: run.py
10
  pinned: false
11
+ hf_oauth: true
12
  ---
 
 
gradio_cached_examples/test ADDED
File without changes
run.ipynb ADDED
@@ -0,0 +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", "\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=random.choice(COLORS)),\n", " )\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 ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 (
13
+ audio,
14
+ gr.make_waveform(audio),
15
+ gr.make_waveform(audio, animate=True),
16
+ gr.make_waveform(audio, bg_image=image, bars_color=random.choice(COLORS)),
17
+ )
18
+
19
+
20
+ gr.Interface(
21
+ audio_waveform,
22
+ inputs=[gr.Audio(), gr.Image(type="filepath")],
23
+ outputs=[
24
+ gr.Audio(),
25
+ gr.Video(),
26
+ gr.Video(),
27
+ gr.Video(),
28
+ ],
29
+ ).launch()