Whisper-STT / app.py
mindspark121's picture
Update app.py
fb41c74 verified
raw
history blame
636 Bytes
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"""
if audio is None:
return "No audio detected. Please try again."
result = model.transcribe(audio)
return result["text"]
# Corrected Gradio UI
gr.Interface(
fn=transcribe,
inputs=gr.Audio(sources=["microphone"], type="filepath"),
outputs="text",
title="Whisper Speech-to-Text",
description="Click 'Record', speak into the microphone, then stop recording to get text output.",
).launch()