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
?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.