Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def save_audio(audio, transcript): | |
| # Save the audio and transcript to a text file for now (for Hugging Face Space demo) | |
| with open("recordings.txt", "a", encoding="utf-8") as f: | |
| f.write(f"Transcript: {transcript}\n") | |
| f.write(f"Audio File Saved: {audio.name}\n\n") | |
| return "Recording saved successfully!" | |
| with gr.Blocks() as demo: | |
| gr.Markdown("## Nupe Audio Dataset Collection Form") | |
| gr.Markdown("Please record your voice and optionally provide a transcription.") | |
| with gr.Row(): | |
| mic = gr.Audio(type="filepath", label="π€ Record Response") | |
| transcript = gr.Textbox(label="π Optional: Transcription of Recording") | |
| save_btn = gr.Button("πΎ Save Recording & Transcription") | |
| output = gr.Textbox(label="Status") | |
| save_btn.click(fn=save_audio, inputs=[mic, transcript], outputs=output) | |
| demo.launch() | |