File size: 589 Bytes
5e3a095
 
 
31edb58
5e3a095
 
 
 
 
 
 
9e2efd6
5e3a095
31edb58
9e2efd6
5e3a095
 
 
 
9e2efd6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from transformers import pipeline

asr_pipeline = pipeline("automatic-speech-recognition", model="ashik1104/Bengali_wav2vec2_BERT_P")

def transcribe(audio):
    result = asr_pipeline(audio)
    return result["text"]

gradio_app = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(type="filepath", label="Upload or record audio"),
    outputs=gr.Textbox(label="Transcription"),
    title="🎤 Automatic Speech Recognition (ASR)",
    description="Upload a file or record your voice to get the transcription.",
)

if __name__ == "__main__":
    gradio_app.launch()