google云语音api:同步识别和异步识别有什么区别?
google cloud speech api: what's the difference between synchronous & asynchronous recognition?
我是 GCP 的新手。
当我阅读 google 演讲 api 的文档时,它说 "Asynchronous Recognition (REST and gRPC) sends audio data to the Speech API and initiates a Long Running Operation. Using this operation, you can periodically poll for recognition results."
但是 "a Long Running Operation" 到底是什么意思呢?同步和异步识别过程有什么区别?
我在互联网上搜索并找到了关于这个的答案:https://www.quora.com/What-is-the-difference-between-synchronous-and-asynchronous-speech-recognition
但我还是想不通。谁能更具体地解释一下?
非常感谢您的回答:)
- 异步云请求通常return请求已排队等待处理的 ID,稍后您可以使用该 ID 检查状态并在完成后检索结果。
- 同步请求 return 结果作为响应的一部分,但它们可能会阻塞更长时间。
您可以使用 gcloud
command line tool 来尝试两者。音频同步请求少于 60 秒
gcloud ml speech recognize AUDIO_FILE ...
和超过 60 秒的音频异步
gcloud ml speech recognize-long-running AUDIO_FILE ...
后者而不是成绩单 return OPERATION_ID
稍后你可以 运行
gcloud ml speech operations describe OPERATION_ID
获取结果。
提示:您可以添加 --log-http
标志以查看 API 请求 gcloud
发出的内容,以便更深入地了解 api 级别的情况。
我是 GCP 的新手。 当我阅读 google 演讲 api 的文档时,它说 "Asynchronous Recognition (REST and gRPC) sends audio data to the Speech API and initiates a Long Running Operation. Using this operation, you can periodically poll for recognition results." 但是 "a Long Running Operation" 到底是什么意思呢?同步和异步识别过程有什么区别? 我在互联网上搜索并找到了关于这个的答案:https://www.quora.com/What-is-the-difference-between-synchronous-and-asynchronous-speech-recognition 但我还是想不通。谁能更具体地解释一下? 非常感谢您的回答:)
- 异步云请求通常return请求已排队等待处理的 ID,稍后您可以使用该 ID 检查状态并在完成后检索结果。
- 同步请求 return 结果作为响应的一部分,但它们可能会阻塞更长时间。
您可以使用 gcloud
command line tool 来尝试两者。音频同步请求少于 60 秒
gcloud ml speech recognize AUDIO_FILE ...
和超过 60 秒的音频异步
gcloud ml speech recognize-long-running AUDIO_FILE ...
后者而不是成绩单 return OPERATION_ID
稍后你可以 运行
gcloud ml speech operations describe OPERATION_ID
获取结果。
提示:您可以添加 --log-http
标志以查看 API 请求 gcloud
发出的内容,以便更深入地了解 api 级别的情况。