Spaces:
Running
Running
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize the pipeline with the specified model | |
| pipe = pipeline(model="Lingalingeswaran/whisper-small-sinhala") | |
| def transcribe(audio): | |
| # Transcribe the audio file to text | |
| text = pipe(audio)["text"] | |
| return text | |
| # Create the Gradio interface | |
| iface = gr.Interface( | |
| fn=transcribe, | |
| inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"), | |
| outputs="text", | |
| title="Whisper Small Sinhala", | |
| description="Realtime demo for Sinhala speech recognition using a fine-tuned Whisper small model.", | |
| ) | |
| # Launch the interface | |
| if __name__ == "__main__": | |
| iface.launch() | |