Spaces:
Sleeping
Sleeping
| 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) |