Audio_image / app.py
nekin12's picture
Update app.py
3eccf54 verified
import gradio as gr
from transformers import pipeline
import numpy as np
transcriber = pipeline("automatic-speech-recognition")
def transcribe(audio):
sr, y = audio
y = y.astype(np.float32)
y /= np.max(np.abs(y))
txt= transcriber({"sampling_rate": sr, "raw": y})["text"]
print(txt)
return txt
demo = gr.Interface(
transcribe,
gr.Audio(sources=["microphone"], type="numpy", label="xerra aqui..."),
"text",
)
demo.launch(share=True , debug=True)