lorem's picture
Update app.py
d28fad4 verified
raw
history blame
422 Bytes
import gradio as gr
import time
from transformers import pipeline
transcriber = pipeline('automatic-speech-recognition',model = "openai/whisper-tiny")
def transcribe(audio):
sr, y = audio
y = y.astype(np.float32)
y /= np.max(np.abs(y))
return transcriber({"sampling_rate": sr, "raw": y})["text"]
demo = gr.Interface(
transcribe,
gr.Audio(sources=["microphone"]),
"text"
)
demo.launch()