Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|