Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import whisper | |
| # Choose model: "tiny" for faster, "base" for better accuracy | |
| model = whisper.load_model("small") | |
| def transcribe(audio): | |
| if audio is None: | |
| return "Please upload an audio file." | |
| result = model.transcribe(audio) | |
| return result["text"] | |
| app = gr.Interface( | |
| fn=transcribe, | |
| inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"), | |
| outputs="textbox", | |
| title="🎙️ Whisper Speech-to-Text", | |
| description="Transcribe audio to text using OpenAI Whisper (Tiny model).", | |
| ) | |
| app.launch() | |