Spaces:
Running
Running
File size: 636 Bytes
20ae1ed fb41c74 20ae1ed fb41c74 20ae1ed fb41c74 20ae1ed fb41c74 20ae1ed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|