|
|
|
import whisper |
|
import gradio as gr |
|
|
|
|
|
device = "cpu" |
|
print("Running on CPU") |
|
|
|
|
|
model_name = "tiny" |
|
whisper_model = whisper.load_model("tiny") |
|
|
|
|
|
def transcribe(audio): |
|
|
|
result = whisper_model.transcribe(audio) |
|
return result["text"] |
|
|
|
|
|
demo = gr.Interface( |
|
fn=transcribe, |
|
inputs=gr.Audio(type="filepath", label="Upload your audio file"), |
|
outputs=gr.Textbox(label="Transcription"), |
|
title="Whisper Speech-to-Text", |
|
description="Record audio using your microphone and get a transcription using the Whisper model." |
|
) |
|
|
|
|
|
demo.launch() |
|
|
|
|