Spaces:
Sleeping
Sleeping
| # app.py | |
| import gradio as gr | |
| # Import backend | |
| from backend import AudioTranscriber | |
| # Initialize the backend transcriber | |
| transcriber = AudioTranscriber() | |
| def transcribe_audio(audio_file): | |
| return transcriber.transcribe(audio_file) | |
| # Define Gradio Interface | |
| demo = gr.Interface( | |
| fn=transcribe_audio, | |
| inputs=gr.Audio( | |
| label="Upload or Record Audio", | |
| sources=["upload", "microphone"], | |
| type="filepath" | |
| ), | |
| outputs=gr.Textbox(label="Transcription", lines=6, placeholder="Transcription will appear here..."), | |
| title="🎙️ Audio Transcription with Whisper", | |
| description="Upload an audio file or record your voice. The backend will transcribe it using Whisper.", | |
| examples=[ | |
| ["example.wav"] # Optional: include a sample file | |
| ], | |
| cache_examples=False, | |
| allow_flagging="never" | |
| ) | |
| # Launch the app | |
| if __name__ == "__main__": | |
| demo.launch(ssr_mode=False) |