File size: 483 Bytes
ebc7502
 
 
63d4527
a760df9
55f0a8a
 
 
 
 
a36980b
 
 
b5c8bc0
 
55f0a8a
b5c8bc0
a36980b
 
ebc7502
3eccf54
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)