Spaces:
Runtime error
Runtime error
juancopi81
commited on
Commit
•
27bce5c
1
Parent(s):
08f8a68
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, bg_image=image, bars_color=random.choice(COLORS)),
|
16 |
+
)
|
17 |
+
|
18 |
+
|
19 |
+
gr.Interface(
|
20 |
+
audio_waveform,
|
21 |
+
inputs=[gr.Audio(), gr.Image(type="filepath")],
|
22 |
+
outputs=[
|
23 |
+
gr.Audio(),
|
24 |
+
gr.Video(),
|
25 |
+
gr.Video(),
|
26 |
+
],
|
27 |
+
).launch()
|