wit-ai / pywit

Python library for Wit.ai
Other
1.45k stars 359 forks source link

Facing problem while doing speech recognition using python client #143

Closed allencarvallo closed 4 years ago

allencarvallo commented 4 years ago

CODE

_from dotenv import loaddotenv import os from wit import Wit

_loaddotenv() _access_token = os.getenv('SERVER_ACCESSTOKEN') _client = Wit(accesstoken) resp = None with open('milk.wav', 'rb') as f: resp = client.speech(f, {'Content-Type': 'audio/wav'}) print() _print('Yay, got Wit.ai response: ' + str(resp)) print()

ERROR

Traceback (most recent call last): File "speech.py", line 15, in resp = client.speech(f, {'Content-Type': 'audio/wav'}) File "C:\Users\Using Wit with python\venv\lib\site-packages\wit\wit.py", line 87, in speech resp = req(self.logger, self.access_token, 'POST', '/speech', params, File "C:\Users\Using Wit with python\venv\lib\site-packages\wit\wit.py", line 40, in req raise WitError('Wit responded with status: ' + str(rsp.status_code) + wit.wit.WitError: Wit responded with status: 400 (Bad Request)

jtliao commented 4 years ago

Can you verify this works when sending a request through cURL directly?

allencarvallo commented 4 years ago

Yes. I have tried a message that i already trained and it worked.