File size: 773 Bytes
280bf21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#                                                                                                                 
# speech recognition                                                                                              
#                                                                                                                 
import numpy as np
import gradio as gr
from transformers import pipeline

asr = pipeline("automatic-speech-recognition", model="openai/whisper-base")

def transcribe(audio):
    english = asr(audio)
    return english['text']

demo = gr.Interface(fn = transcribe,
                    inputs=gr.Audio(type="filepath"),
                    outputs = "text",
                    title = "Whisper Speech Recognition")

demo.launch()