|
from transformers import pipeline |
|
import gradio as gr |
|
|
|
|
|
pipe = pipeline( |
|
"automatic-speech-recognition", |
|
model="MohammadGholizadeh/whisper-large-v3-persian-common-voice-17", |
|
chunk_length_s=30, |
|
return_timestamps=False |
|
) |
|
|
|
|
|
def transcribe(audio): |
|
text = pipe(audio)["text"] |
|
return text |
|
|
|
|
|
iface = gr.Interface( |
|
fn=transcribe, |
|
inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"), |
|
outputs="text", |
|
title="Whisper Large V3 Persian", |
|
description="Realtime demo for Persian speech recognition using a fine-tuned Whisper Large model on Mozilla Common Voice.", |
|
) |
|
|
|
iface.launch() |
|
|