Reputation: 51
When I run my code, wit.ai try to recognize English words of "myspeech.wav" but that is Persian voice, How should I change my code?
def RecognizeSpeech(AUDIO_FILENAME):
audio = open('myspeech.wav','r')
headers = {'authorization': 'Bearer ' + wit_access_token,
'Content-Type': 'audio/wav'}
resp = requests.post(API_ENDPOINT, headers = headers,
data = audio)
data = json.loads(resp.content)
text = data['_text']
return text
Upvotes: 2
Views: 785
Reputation: 879
If you set the language in the setting of your app in wit console to Persian, that should works!
You can alternatively use:
curl -XPOST 'https://api.wit.ai/speech' -i -L -H 'Authorization: Bearer YOURAPPTOKEN' -H "Content-Type: audio/wav" --data-binary "@sample.wav"
which returns the JSON of the recognized text, intent, and entities.
Upvotes: 5