BenDaouda's picture
Gradio App with the new model
25ff4a9
from transformers import pipeline, AutoTokenizer
from huggingface_hub import login
import gradio as gr
login('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')
# Spécifiez le nom du modèle et le jeton d'authentification
model_name = "BenDaouda/wav2vec2-large-xls-wolof-asr"
token = "vhf_IwkuGBEkyipKSnyJzJcCRSwOSJDvNivOmH"
# Chargez le modèle et le tokenizer en utilisant le jeton d'authentification
tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=True)
model = pipeline("automatic-speech-recognition", model=model_name, tokenizer=tokenizer, use_auth_token=True)
# Utilisez la fonction Gradio avec votre modèle chargé
def transcribe(audio):
result = model(audio)["text"]
return result
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(source="microphone", type="filepath"),
outputs="text"
)
iface.launch()