|
import gradio as gr |
|
import whisper |
|
|
|
|
|
def transcribe_audio(model_size, audio): |
|
|
|
model = whisper.load_model(model_size) |
|
|
|
|
|
result = model.transcribe(audio) |
|
|
|
return result['text'] |
|
|
|
|
|
iface = gr.Interface( |
|
fn=transcribe_audio, |
|
inputs=[ |
|
gr.Dropdown(label="Choose Whisper Model", choices=["tiny", "base", "small", "medium", "large"], value="base"), |
|
gr.Audio(type="filepath") |
|
], |
|
outputs="text", |
|
title="Whisper Audio Transcription", |
|
description="Upload an audio file and select a Whisper model to get the transcription." |
|
) |
|
|
|
|
|
iface.launch() |
|
|