Jayahae commited on
Commit
d9d69a7
·
verified ·
1 Parent(s): 968e7b6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import scipy.io.wavfile
4
+
5
+ def save_audio(audio):
6
+ # The audio parameter is a tuple (sample_rate, data)
7
+ sample_rate, data = audio
8
+ output_file = "recorded_audio.wav"
9
+ scipy.io.wavfile.write(output_file, sample_rate, data)
10
+ return output_file
11
+
12
+ iface = gr.Interface(
13
+ fn=save_audio,
14
+ inputs=gr.Audio(type="numpy", label="Record your voice"),
15
+ outputs=gr.File(label="Download your recorded audio"),
16
+ title="Voice Recorder",
17
+ description="Record your voice and download the audio file."
18
+ )
19
+
20
+ iface.launch(share=True)