asr-th / app.py
patharanor's picture
feat:thai language
f4e5887
raw
history blame
467 Bytes
import gradio as gr
from transformers import pipeline
import numpy as np
model_name = "airesearch/wav2vec2-large-xlsr-53-th"
transcriber = pipeline("automatic-speech-recognition", model=model_name)
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()