File size: 922 Bytes
f46eab4
8a6c8ee
1bf0075
f46eab4
 
 
 
 
1bf0075
8a6c8ee
f46eab4
8a6c8ee
f46eab4
8a6c8ee
 
f46eab4
 
 
 
 
 
8a6c8ee
f46eab4
8a6c8ee
f46eab4
8a6c8ee
f46eab4
8a6c8ee
 
 
 
f46eab4
6570ffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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)