import whisper import gradio as gr # Load Whisper Model model = whisper.load_model("small") # Change to "base", "medium", or "large" if needed def transcribe(audio): """Transcribe Speech to Text""" result = model.transcribe(audio) return result["text"] # Gradio UI with Microphone gr.Interface( fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text", title="Whisper Speech-to-Text", description="Speak into the microphone and get text output.", ).launch()