UZ_STT / app.py
mustafoyev202's picture
Create app.py
9a52329 verified
raw
history blame
830 Bytes
# Load model directly
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
processor = AutoProcessor.from_pretrained("mustafoyev202/whisper-uz-adv")
model = AutoModelForSpeechSeq2Seq.from_pretrained("mustafoyev202/whisper-uz-adv")
from transformers import pipeline
import gradio as gr
pipe = pipeline(
task="automatic-speech-recognition",
model=model,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
return_timestamps=True
)
def transcribe(audio):
text = pipe(audio)["text"]
return text
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(type="filepath"),
outputs="text",
title="Whisper Small Uzbek",
description="Realtime demo for Uzbek speech recognition using a fine-tuned Whisper small model.",
)
iface.launch(share=True)