UmarBaba1 commited on
Commit
16099b3
·
verified ·
1 Parent(s): 1ffa689

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +24 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+
4
+ def save_audio(audio, transcript):
5
+ # Save the audio and transcript to a text file for now (for Hugging Face Space demo)
6
+ with open("recordings.txt", "a", encoding="utf-8") as f:
7
+ f.write(f"Transcript: {transcript}\n")
8
+ f.write(f"Audio File Saved: {audio.name}\n\n")
9
+ return "Recording saved successfully!"
10
+
11
+ with gr.Blocks() as demo:
12
+ gr.Markdown("## Nupe Audio Dataset Collection Form")
13
+ gr.Markdown("Please record your voice and optionally provide a transcription.")
14
+
15
+ with gr.Row():
16
+ mic = gr.Audio(type="filepath", label="🎤 Record Response")
17
+ transcript = gr.Textbox(label="📝 Optional: Transcription of Recording")
18
+
19
+ save_btn = gr.Button("💾 Save Recording & Transcription")
20
+ output = gr.Textbox(label="Status")
21
+
22
+ save_btn.click(fn=save_audio, inputs=[mic, transcript], outputs=output)
23
+
24
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio