Spaces:
Sleeping
Sleeping
| # Load model directly | |
| from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq | |
| processor = AutoProcessor.from_pretrained("mustafoyev202/whisper-uz") | |
| model = AutoModelForSpeechSeq2Seq.from_pretrained("mustafoyev202/whisper-uz") | |
| 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) |