File size: 578 Bytes
d9d69a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import numpy as np
import scipy.io.wavfile

def save_audio(audio):
    # The audio parameter is a tuple (sample_rate, data)
    sample_rate, data = audio
    output_file = "recorded_audio.wav"
    scipy.io.wavfile.write(output_file, sample_rate, data)
    return output_file

iface = gr.Interface(
    fn=save_audio,
    inputs=gr.Audio(type="numpy", label="Record your voice"),
    outputs=gr.File(label="Download your recorded audio"),
    title="Voice Recorder",
    description="Record your voice and download the audio file."
)

iface.launch(share=True)