1006 Error code in IBM Watson speech-to-text API

假如想象 提交于 2019-11-29 17:26:10

As a general recommendation, file based recognition, and especially if the files are bigger than a few MBs, should be done using the Watson /recognitions API (more details here: https://cloud.ibm.com/apidocs/speech-to-text), which is asynchronous. You do not need to keep a connection open for a few hours, that is not a good practice since you could run into a read timeout, you could lose network connectivity, etc. By doing it asynchronously you POST the file and then the connection ends, then you can GET status every X minutes, or be notified via callback, whatever works better for you.

curl -X POST -u "apikey:{apikey}" --header "Content-Type: audio/flac" --data-binary @audio-file.flac "https://stream.watsonplatform.net/speech-to-text/api/v1/recognitions?callback_url=http://{user_callback_path}/job_results&user_token=job25&timestamps=true"

btw. is your websockets client using ping-pong frames to keep connections alive? I noticed that you do not request interim results ({"content-type":"audio\/mpeg","timestamps":true,"speaker_labels":true,"smart_formatting":true,"inactivity_timeout":-1,"interim_results":false,"max_alternatives":1,"word_confidence":false,"action":"start"}), that is another way to keep a connection open, but less reliable. Please check the ping pong frames.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!