gpt4 book ai didi

node.js - 语音识别惨败: Wrong status code 401 in Bing Speech API/token

转载 作者:太空宇宙 更新时间:2023-11-04 01:25:50 26 4
gpt4 key购买 nike

当我尝试使用 Azure Bing Speech to Text Api 将示例音频从英语翻译为其他语言时,出现错误:语音识别严重失败:Bing Speech API/ token 中的状态代码 401 错误

我尝试将 open_timeout 增加到更高的值,例如 50000(建议用于慢速互联网),在第 110 行的 bingspeech-api-client 中硬编码,但错误仍然存​​在。

let audioStream = fs.createReadStream('hello.wav'); 
// Bing Speech Key (https://www.microsoft.com/cognitive-services/en-us/subscriptions)
let subscriptionKey = '******';
let client = new BingSpeechClient(subscriptionKey);

client.recognizeStream(audioStream).then(function(response)
{

console.log("response is ",response);
console.log("-------------------------------------------------");
console.log("response is ",response.results[0]);
}).catch(function(error)
{
console.log("error occured is ",error);
});

此代码应从该示例音频文件生成文本。

最佳答案

代码 401 表示未经授权 - 您的情况下 key 错误。我怀疑您遵循了某些教程的过时版本,因为现在该服务不再称为 Bing Speech API。请参阅此处,了解使用适用于 Node.js 的 microsoft-cognitiveservices-speech-sdk SDK 的最新教程。

https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstart-js-node#use-the-speech-sdk

关于node.js - 语音识别惨败: Wrong status code 401 in Bing Speech API/token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57534940/

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