cURL 未指定 url

MaG*_*aGi 4 curl speech-to-text ibm-cloud

我正在按照本教程在 IBM Bluemix 中设置语音到文本服务:https ://www.ibm.com/watson/developercloud/doc/speech-to-text/tutorial.shtml

我已经安装并测试了先决条件,但不知何故,当我尝试输入时出现错误:

curl -X POST -u <username>:<password>
--header "Content-Type: audio/flac"
--header "Transfer-Encoding: chunked"
--data-binary @<path>audio-file.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
Run Code Online (Sandbox Code Playgroud)

我在直接访问 url 时测试了用户名和密码并且它工作正常。我为音频文件输入的路径也是正确的,因为我刚刚复制了它。

有谁知道如何解决这一问题?提前致谢!:)

joe*_*joe 6

您缺少新行的转义符。尝试这样的事情:

curl -X POST -u "myusername":"mypassword" \
--header "Content-Type: audio/flac" \
--data-binary "@audio-file1.flac" \
--data-binary "@audio-file2.flac" \
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?timestamps=true&word_alternatives_threshold=0.9&keywords=%22colorado%22%2C%22tornado%22%2C%22tornadoes%22&keywords_threshold=0.5&continuous=true"
Run Code Online (Sandbox Code Playgroud)

示例音频文件