Spaces:
Runtime error
Runtime error
from transformers import pipeline, AutoTokenizer | |
# Spécifiez le nom du modèle et le jeton d'authentification | |
model_name = "BenDaouda/wav2vec2-large-xls-r-300m-wolof-test-coloab" | |
token = "votre-jeton-d'authentification-hugging-face" | |
# 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, task="asr", use_auth_token=True) | |
# Utilisez la fonction Gradio avec votre modèle chargé | |
def transcribe(audio): | |
result = model(audio) | |
return result[0]['text'] | |
iface = gr.Interface( | |
fn=transcribe, | |
inputs=gr.inputs.Audio(source="microphone", type="file", resample_to=16000), | |
outputs="text" | |
) | |
iface.launch() |