2017-02-27 41 views
0

我使用存储在系统中的输入flac文件向Watson语音到文本API发出了一个curl请求。我使用了存储在我的系统中的音频/声像文件的路径。我想将它存储在云端的某个位置,并使用音频文件的URL作为我的输入。请让我知道如何做到这一点。 下面是其中I使用存储在我的系统后手文件传递输入卷曲请求:在WATSON语音到文本API中传递URL而不是系统路径

curl -X POST -u username:password --header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary @/home/rishabh/Desktop/watson/test_file.flac "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true" 

在上述请求输入文件路径是:/home/rishabh/Desktop/watson/test_file.flac。如何通过URL作为URL

+1

嗨Rishabh,目前这个功能是不可用的沃森语音服务。 –

回答

2

这是不可能的,因为Watson服务以您的名义下载文件,但可以通过一个不保存的单个命令将文件下载并转发到Watson您的计算机上的本地副本:

curl "https://watson-test-resources.mybluemix.net/resources/weather.flac" | curl -X POST -u "username:password" --header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary @- "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

这里要注意的几件事情:

  1. 有两个curl命令。第一个提取文件,第二个发送给Watson。
  2. 它们与管操作部连接,|
  3. 第二curl命令被告知经由--data-binary @-标志以接受来自第一输入端。
相关问题