Inference api other languages

#19
by bann - opened

I am trying to use api inference for other languages but without success yet

API_URL = "https://api-inference.huggingface.co/models/openai/whisper-medium"
headers = {"Authorization": "Bearer xxxx"}

def query(filename, language="pt"):
with open(filename, "rb") as f:
sound = f.read()
sound_base64 = base64.b64encode(sound).decode("utf-8") # Codificar em base64
data = {"inputs": {"speech": sound_base64, "language": language}}
response = requests.post(API_URL, headers=headers, json=data)
return response.json()

I get the feedback

{'error': ['Error in inputs: Malformed soundfile']}

I am also looking for a way to get transcript from Spanish to Spanish instead from Spanish (audio) to English. I am looking for some instructions, but didn't managed to find anything...
Any help is welcome.

Sign up or log in to comment