File size: 514 Bytes
34d8803
ce40abd
34d8803
ce40abd
 
 
 
e1e2511
ce40abd
 
e1e2511
 
ce40abd
 
 
 
 
e1e2511
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import whisper

def transcribe_audio(audio_file):
    model = whisper.load_model("base")
    result = model.transcribe(audio_file)
    return result["text"]

audio_input = gr.inputs.Audio(source="upload", type="file")
output_text = gr.outputs.Textbox()

iface = gr.Interface(
    fn=transcribe_audio,
    inputs=audio_input,
    outputs=output_text,
    title="Audio Transcription App",
    description="Upload an audio file or record in real-time and hit the 'Submit' button"
)

iface.launch()