File size: 621 Bytes
59d54da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

def save_audio(audio):
    """
    This function simply returns the audio file it receives, simulating a save.
    Gradio handles the recording directly in the browser.
    """
    return audio

# Create a Gradio interface for recording audio
iface = gr.Interface(
    fn=save_audio,
    inputs=gr.Audio(source="microphone", type="filepath"),
    outputs=gr.Audio(label="Playback Recorded Audio"),
    title="Simple Browser-Based Voice Recorder",
    description="Click 'Record' to start recording. Click 'Stop' to end recording. Playback the recording below."
)

# Run the Gradio app
iface.launch()