semakoc commited on
Commit
6101a2c
·
verified ·
1 Parent(s): e93db55

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Returns recorded audio and handles no audio condition
4
+ def record_audio(audio):
5
+ if audio is None:
6
+ return None
7
+ return audio
8
+
9
+ with gr.Blocks() as demo:
10
+ gr.Markdown("Audio Recorder & Playback")
11
+
12
+ audio_input = gr.Audio(type="filepath", label="Record Your Audio")
13
+ record_button = gr.Button("Play Recorded Audio")
14
+ audio_output = gr.Audio(label="Playback")
15
+
16
+ # Play back button of recorded audio
17
+ record_button.click(fn=record_audio, inputs=audio_input, outputs=audio_output)
18
+
19
+ demo.launch()