File size: 454 Bytes
3198280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import gradio as gr
from transformers import pipeline


pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")

def transcribe(audiofile):
    transcription = pipeline(audiofile)
    return transcription


demo = gr.Interface(
    fn=transcribe,
    inputs="microphone",
    #inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
    outputs="text"
)


if __name__ == "__main__":
    demo.launch()