File size: 713 Bytes
1ecbd6e
59d8ead
35c0394
 
0d5a69e
35c0394
 
 
867943a
 
161393d
f9b726c
35c0394
f9b726c
161393d
f9b726c
161393d
 
 
f9b726c
 
 
 
 
cd06e6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gradio as gr

# Load the model without launching the interface
loaded_model = gr.Interface.load("models/openai/whisper-large-v2", allow_launch=False)

def transcribe_audio(audio_file):
    # Use the loaded model to transcribe the audio
    return loaded_model(audio_file)

audio_input = gr.inputs.Audio(type="filepath")
text_output = gr.outputs.Textbox()

# Setup the custom Gradio interface with your configurations
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()