【发布时间】:2019-02-28 17:52:10
【问题描述】:
我希望能够发表演讲:在我自己的云托管资源上识别请求,因此我可以简单地登录 Google Cloud Platform 控制台,在 Cloud Shell 中运行命令,然后查看结果。很像https://cloud.google.com/speech-to-text/docs/quickstart-protocol,除了不使用本地的任何东西。
不确定要分享哪些其他重要信息,但我云中的 .json 和 .flac 文件具有公共读取权限。
我怎样才能做到这一点?
我的要求:
curl -H "Content-Type: application/json" https://speech.googleapis.com/v1/speech:recognize?key=[my-api-key] -d @https://storage.googleapis.com/[bucket]/[json-request-filename].json
回复:
Warning: Couldn't read data from file
Warning: "https://storage.googleapis.com/[bucket]/[json-request-filename].json",
Warning: this makes an empty POST.
{
"error": {
"code": 400,
"message": "RecognitionAudio not set.",
"status": "INVALID_ARGUMENT"
}
}
这是托管在谷歌云存储中的 .json:
{
"config": {
"encoding":"FLAC",
"sampleRateHertz": 16000,
"languageCode": "en-US",
"enableWordTimeOffsets": false
},
"audio": {
"uri":"gs://[bucket]/[audio-filename].flac"
}
}
没有新信息,但 Google Cloud Platform Shell 的外观如下:
[my-account]@cloudshell:~ ([my-project])$ curl -H "Content-Type: application/json" https://speech.googleapis.com/v1/speech:recognize?key=[my-api-key] -d @https://storage.googleapis.com/[bucket]/[json-request-filename].json
Warning: Couldn't read data from file
Warning: "https://storage.googleapis.com/[bucket]/[json-request-filename].json",
Warning: this makes an empty POST.
{
"error": {
"code": 400,
"message": "RecognitionAudio not set.",
"status": "INVALID_ARGUMENT"
}
}
【问题讨论】:
标签: google-cloud-platform google-speech-api