Norphel commited on
Commit
c18cbed
·
verified ·
1 Parent(s): 79506c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -1,7 +1,19 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import shutil
3
 
4
+ def process_audio(audio_path):
5
+ # Define a location to save the audio file
6
+ saved_path = "saved_audio.wav"
7
+ shutil.copy(audio_path, saved_path) # Save the recorded file
8
 
9
+ return saved_path # Return the file path for playback
10
+
11
+ iface = gr.Interface(
12
+ fn=process_audio,
13
+ inputs=gr.Audio(source="microphone", type="filepath"), # Records & provides a file path
14
+ outputs=gr.Audio(type="filepath"), # Plays back the recorded audio
15
+ title="Record & Play Audio",
16
+ description="Press record, speak, and listen to your recorded audio."
17
+ )
18
+
19
+ iface.launch()