Spaces:
Build error
Build error
| from transformers import pipeline | |
| import gradio as gr | |
| # Load model | |
| pipe = pipeline( | |
| "automatic-speech-recognition", | |
| model="baaabaei/whisper-small-fa" | |
| ) | |
| def transcribe(audio): | |
| text = pipe(audio)["text"] | |
| return text | |
| # Create Gradio interface | |
| interface = gr.Interface( | |
| fn=transcribe, | |
| inputs=gr.Audio(sources=["microphone"], type="filepath"), | |
| outputs="text", | |
| title="Persian Speech Recognition", | |
| description="Real-time Persian speech-to-text using fine-tuned Whisper-small", | |
| # examples=[["path_to_sample_audio.wav"]] # Add sample audio if available | |
| ) | |
| interface.launch() |