|
import gradio as gr |
|
|
|
|
|
loaded_model = gr.Interface.load("models/openai/whisper-large-v2", allow_launch=False) |
|
|
|
def transcribe_audio(audio_file): |
|
|
|
return loaded_model(audio_file) |
|
|
|
audio_input = gr.inputs.Audio(type="filepath") |
|
text_output = gr.outputs.Textbox() |
|
|
|
|
|
iface = gr.Interface( |
|
fn=transcribe_audio, |
|
inputs=audio_input, |
|
outputs=text_output, |
|
title="Speech-to-Text using Whisper v2", |
|
description="Upload an audio file to transcribe it to text.", |
|
theme="Monochrome", |
|
live=True, |
|
capture_session=True, |
|
) |
|
|
|
iface.launch() |