wave2vec2 / app.py
Devion333's picture
Update app.py
1b49893 verified
raw
history blame contribute delete
630 Bytes
import os
os.environ["TRANSFORMERS_NO_TF"] = "1"
from transformers import pipeline
import gradio as gr
# Explicitly define the task so HF knows it's ASR
pipe = pipeline(
task="automatic-speech-recognition",
model="Devion333/wav2vec2-xls-r-300m-dv"
)
def transcribe(audio):
return pipe(audio)["text"]
demo = gr.Interface(
fn=transcribe,
inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"),
outputs="text",
title="Wav2Vec2 ASR Demo",
description="Realtime demo for English speech recognition using Devion333/wav2vec2-xls-r-300m-dv."
)
if __name__ == "__main__":
demo.launch()