File size: 650 Bytes
a088775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
import whisper
import gradio as gr


model = whisper.load_model('base')


def transcribe(inputs, task):
    if inputs is None:
        raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")

    result = model.transcribe(inputs)
    return  result["text"]


interface = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(sources=["microphone"],type="filepath"),
    outputs="text",
    title="Whisper Large V3: Transcribe Audio",
    description=(
        "Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the OpenAI Whisper"
    )
)

interface.launch()