gpt4 book ai didi

google-cloud-platform - Google Cloud Speech API longrunningrecognize 仅返回名称

转载 作者:行者123 更新时间:2023-12-05 00:15:39 25 4
gpt4 key购买 nike

我正在尝试使用 Google Cloud Speech API 将一个多小时的音频数据转换为文本,并且我正在使用 API 资源管理器,因为它很简单。

请求看起来像这样。

POST https://speech.googleapis.com/v1/speech:longrunningrecognize?key={YOUR_API_KEY}
{
"audio": {
"uri": "gs://data/audio.flac"
},
"config": {
"encoding": "FLAC",
"languageCode": "en-US"
}
}

响应看起来像这样。
200 
Show headers
{
"name": "`numbers`"
}

为什么它只返回名称,而不返回音频的文本?

最佳答案

刚刚有同样的问题。

https://cloud.google.com/speech/docs/async-recognize 上找到答案

If the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format:


{
"name": "5543203840552489181"
}

where name is the name of the long running operation created for the request. Wait approximately 30 seconds for processing to complete. To retrieve the result of the operation, make a GET request:


GET https://speech.googleapis.com/v1/operations/YOUR_OPERATION_NAME?key=YOUR_API_KEY

得到我的结果:
curl -s -k -H "Content-Type: application/json" \
-H "Authorization: Bearer {access_token}" \
https://speech.googleapis.com/v1/operations/{name}

关于google-cloud-platform - Google Cloud Speech API longrunningrecognize 仅返回名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44037026/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com