1

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?

  • This does not seem like a programming question. – gspr Aug 31 '20 at 07:57
  • I’m asking about the API-related problem, and how it functions, I explained what i tried and what were my guesses. Why is that not a programming question? – ragingPotato Aug 31 '20 at 07:59
  • I'm having the same issue, even with wav files. Most of the time it works, but sometimes it just keep returning empty _text and entities.. – frzsombor Feb 20 '21 at 10:04

1 Answers1

1

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.