Spaces:
Runtime error
Runtime error
File size: 851 Bytes
832feba bf96a3e 5ef3438 bf96a3e f66a079 1f855d9 832feba 25ff4a9 e0a00e6 1f855d9 832feba 2647c46 832feba 5f34871 257dbc1 5f34871 a8c5052 5f34871 314bad3 1f855d9 bb9237d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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() |