mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-03 01:50:59 +08:00
ad9fb84f05
* make waveform animate * fixes * changelog * fix * Update CHANGELOG.md * format * fix * changes * add animate flag * format * fixes * demo * fixes * lint --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
30 lines
569 B
Python
30 lines
569 B
Python
import gradio as gr
|
|
import random
|
|
|
|
|
|
COLORS = [
|
|
["#ff0000", "#00ff00"],
|
|
["#00ff00", "#0000ff"],
|
|
["#0000ff", "#ff0000"],
|
|
]
|
|
|
|
def audio_waveform(audio, image):
|
|
return (
|
|
audio,
|
|
gr.make_waveform(audio),
|
|
gr.make_waveform(audio, animate=True),
|
|
gr.make_waveform(audio, bg_image=image, bars_color=random.choice(COLORS)),
|
|
)
|
|
|
|
|
|
gr.Interface(
|
|
audio_waveform,
|
|
inputs=[gr.Audio(), gr.Image(type="filepath")],
|
|
outputs=[
|
|
gr.Audio(),
|
|
gr.Video(),
|
|
gr.Video(),
|
|
gr.Video(),
|
|
],
|
|
).launch()
|