【问题标题】:google cloud speech api: what's the difference between synchronous & asynchronous recognition?谷歌云语音api:同步和异步识别有什么区别?
【发布时间】:2018-01-08 01:58:49
【问题描述】:

我是 GCP 的新手。 当我阅读谷歌语音 api 的文档时,它说“异步识别(REST 和 gRPC)将音频数据发送到语音 API 并启动一个长时间运行的操作。使用此操作,您可以定期轮询识别结果。” 但“长期运行的操作”实际上意味着什么?同步和异步识别的过程有什么区别? 我在互联网上搜索并找到了关于此的答案:https://www.quora.com/What-is-the-difference-between-synchronous-and-asynchronous-speech-recognition 但我仍然无法理解。谁能更具体地解释一下? 非常感谢您的回答:)

【问题讨论】:

    标签: google-cloud-platform google-speech-api


    【解决方案1】:
    • 异步云请求通常会返回请求已排队等待处理的 id,稍后您可以使用该 id 检查状态并在完成后检索结果。
    • 同步请求将结果作为响应的一部分返回,但它们可能会阻塞更长时间。

    您可以使用gcloud command line tool 来尝试两者。少于 60 秒的音频同步请求

    gcloud ml speech recognize AUDIO_FILE ...
    

    音频的异步时间更长,超过 60 秒

    gcloud ml speech recognize-long-running AUDIO_FILE ...
    

    后者而不是成绩单将返回 OPERATION_ID 稍后您可以运行

    gcloud ml speech operations describe OPERATION_ID
    

    获得结果。

    提示:您可以添加 --log-http 标志以查看 gcloud 发出的 API 请求,以便更深入地了解 API 级别的情况。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-09
      • 1970-01-01
      • 1970-01-01
      • 2021-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多