ragingPotato
ragingPotato

Reputation: 21

Wit AI speech recognition

I am trying to submit an audio in ogg format to https://api.wit.ai/speech?v=20200513. I need to receive a text representation of the voice. When I submit the code through curl request, it returns empty response as {"_text": "", "entities": ""}. I also tried to execute it with pywit. Below is the code:

from wit import Wit

client = Wit('XXXXXXXXXXXXXXXXX')
with open('2.ogg', 'rb') as f:
    print(f)
    resp = client.post_speech(f, content_type='audio/ogg')

print('Yay, got Wit.ai response: ' + str(resp))

My guess was that the file is not captured, but print shows _io.BufferedReader name='2.ogg', which means that the file is stored in the buffer, but wit ai refuses to transcribe it.

Why does wit respond with empty _text?

Upvotes: 1

Views: 2332

Answers (1)

ragingPotato
ragingPotato

Reputation: 21

Not sure why, but the problem happens only with OGG files even though documentation states that it does work with this file extension. So, I had to convert the audio into WAV and try again. This time it worked perfectly well.

Upvotes: 1

Related Questions