Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 谷歌云语音API中的无效音频源错误_Google Cloud Platform_Google Cloud Speech - Fatal编程技术网

Google cloud platform 谷歌云语音API中的无效音频源错误

Google cloud platform 谷歌云语音API中的无效音频源错误,google-cloud-platform,google-cloud-speech,Google Cloud Platform,Google Cloud Speech,我已经按照谷歌的做法设置了使用云语音API的一切。但是,当我尝试发送以下请求时: gcloud ml speech recognize'gs://cloud samples tests/speech/brooklyn.flac'——language code='en-US' 我不断得到以下错误: 错误:(gcloud.ml.speech.recognize)无效的音频源['gs://cloud samples tests/speech/brooklyn.flac']。源必须是本地路径或Googl

我已经按照谷歌的做法设置了使用云语音API的一切。但是,当我尝试发送以下请求时:

gcloud ml speech recognize'gs://cloud samples tests/speech/brooklyn.flac'——language code='en-US'

我不断得到以下错误:

错误:(gcloud.ml.speech.recognize)无效的音频源['gs://cloud samples tests/speech/brooklyn.flac']。源必须是本地路径或Google云存储URL(如gs://bucket/object)

我还尝试谷歌的使用语音API从命令文件使用卷曲请求。。。但是当我发送以下请求时,我没有得到任何响应

curl -s -H "Content-Type: application/json"
    -H "Authorization: Bearer "$(gcloud auth print-access-token) 
    https://speech.googleapis.com/v1/speech:recognize 
    -d @sync-request.json 

我不知道我做错了什么。。。任何帮助都将不胜感激。。提前感谢

注释者完全正确,出于某种原因,文件参数的引号是问题所在。本地文件和谷歌云存储托管文件似乎都是如此。我也有同样的问题,去掉引号就能解决问题。这可能是一个特定于平台的问题-我正在Windows 10上使用gcloud。

对于我来说,在Windows 7的命令行上,以下操作最终起到了作用:


gcloud ml speech recognize gs://cloud samples tests/speech/brooklyn.flac--language code=“en-US”

我在Mac OS上引用本地文件时遇到了同样的问题。当我删除引号时,效果很好

这不起作用 gcloud ml speech recognize long running'/Users/interview/STEREO/FOLDER01/ZOOM0001.WAV' --语言代码='en-US'--异步

像下面那样删除引号。想想看吧 gcloud ml speech recognize long running/Users/interview/立体声/FOLDER01/ZOOM0001.WAV

--语言代码class='en-US'--async

我也有类似的问题。最后我发现我必须删除音频文件名brooklyn.flac后的反斜杠

它是这样的:

gcloud ml speech recognize gs://cloud samples tests/speech/brooklyn.flac \--language code=en US
在删除反斜杠后,我刚刚使用了以下命令:

gcloud ml speech recognize gs://cloud samples tests/speech/brooklyn.flac--language code=en US

我尝试了第一个教程,它对我很有效。我注意到的是,当我更改bucket路径(在开头添加一个“a”)时,它返回的错误与您的相同,但没有引号(我看到
[ags://cloud-samples-tests/speech/brooklyn.flac]
而不是
['ags://cloud-samples-tests/speech/brooklyn.flac“]
)。你能试着执行相同的命令而不使用bucket path的引号吗?别忘了删除我们周围的引号,不是OP一直遇到问题的同一个命令行吗?