我开始使用卷曲的文本到语音,我遇到了麻烦。我用我的凭据从命令行中的exemple复制代码,但是有一个我无法解决的错误:curl:没有指定URL!
这是我尝试的代码:
curl -X POST -u {username}:{password} \
--header "Content-Type: application/json" \
--header "Accept: audio/wav" \
--data "{\"text\":\"hello world\"}" \
--output hello_world.wav \
"https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize"
这里是命令行中的代码(win10):
Curl in command line no url specified
我可以帮忙吗? :)
在Windows提示符中,由于报价中的引用而令人望而生畏。我尝试了这个并且工作:
--data'{“text”:“hello world”}',另一个是--data“{\”text \“:\”hello world \“}'
(即如果你在双引号中只使用双引号,你必须使用\,并且之后也没有空格:)
-X POST -u“apikey:xxxxxxxxxxxxxxxxxxxxx”--header“Content-Type:application / json”--header“Accept:audio / wav”--data'{“text”:“hello world”}' - output hello_world.wav“https://stream.watsonplatform.net/api/text-to-speech/api/v1/synthesize”
C:\ Users \ rpo \ IBM-Watson> curl -X POST -u“apikey:xxxxxxxxxxxxxxxxxx”--header“Content-Type:application / json”--header“Accept:audio / wav”--data“{\ “text \”:\“hello world \”}“ - output”hello_world.wav“https://stream.watsonplatform.net/api/text-to-speech/api/v1/synthesize
您在(不必要的引用)URL和--output
开关的值之间没留下空格。