File size: 636 Bytes
31f32e6 a89ac0c 31f32e6 6a68038 31f32e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import os
import gradio as gr
def reverse_audio(audio):
sr, data = audio
return audio
with gr.Blocks(title="Mic Test") as demo:
src = "https://onj.me/shorts/audio/02-Who%27s%20the%20bossa%21.mp3"
gr.HTML(f"<audio src='{src}' autoplay controls></audio>", visible=True)
mic = gr.Audio(
sources=["microphone"],
waveform_options=gr.WaveformOptions(
waveform_color="#01C6FF",
waveform_progress_color="#0066B4",
skip_length=2,
show_controls=False,
),
)
mic.stop_recording(
fn=reverse_audio,
inputs=mic,
outputs=gr.Audio()
)
demo.launch()
|