身份验证错误(401)Azure语音到文本
当我使用azure语音到文本的免费试用版时,出现了此错误:Cancelled CancellationDetails(原因=CancellationReason.error,error\u details=“WebSocket升级失败:身份验证错误(401)。请检查订阅信息和区域名称 我创建了一个acompt Microsoft azure,并遵循语音服务文档。当我创建一个资源时,我得到了两个密钥和一个位置 在我的代码中,我写道:身份验证错误(401)Azure语音到文本,azure,speech-recognition,Azure,Speech Recognition,当我使用azure语音到文本的免费试用版时,出现了此错误:Cancelled CancellationDetails(原因=CancellationReason.error,error\u details=“WebSocket升级失败:身份验证错误(401)。请检查订阅信息和区域名称 我创建了一个acompt Microsoft azure,并遵循语音服务文档。当我创建一个资源时,我得到了两个密钥和一个位置 在我的代码中,我写道: speech_key, service_region = &qu
speech_key, service_region = "<key>", "<location>"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
speech\u key,service\u region=“”,“
speechsdk.SpeechConfig(订阅=语音密钥,区域=服务区域)
当我运行此代码时,会显示此错误。我确信我输入了正确的键和位置
你知道我是忘了什么还是做了什么坏事吗?我刚刚测试了代码,它工作正常
import azure.cognitiveservices.speech as speechsdk
from azure.cognitiveservices.speech.audio import AudioOutputConfig
# Replace with your own subscription key and service region (e.g., "westus")
# Side note: some regions do not support text-to-speech
speech_key, service_region = "subscription_key", "service_region"
# Replace with input file name and format
input_file = open("input_file.txt", "r")
text = input_file.read()
# Replace desired output file name and format
output_file = "output_file.mp3"
# Creates an instance of a speech config with a specified subscription key and service region
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
我有相同的代码,但我没有使用音频文件。你使用的是免费试用版吗?