【发布时间】:2021-10-01 02:31:39
【问题描述】:
我可以在没有终结点的情况下使用 Azure 语音资源吗?
我正在阅读微软教程。具体来说,我正在完成this 实验室。而在本实验中,语音资源的应用程序客户端不使用端点,它只使用密钥和位置。
文档中的here 也是如此:
To find the keys and location/region of a completed deployment, follow these steps:
1. Sign in to the Azure portal using your Microsoft account.
2. Select All resources, and select the name of your Cognitive Services resource.
3. On the left pane, under RESOURCE MANAGEMENT, select Keys and Endpoint.
Each subscription has two keys; you can use either key in your application. To copy/paste a key to your code editor or other location, select the copy button next to each key, switch windows to paste the clipboard contents to the desired location.
Additionally, copy the LOCATION value, which is your region ID (ex. westus, westeurope) for SDK calls.
如您所见,没有任何关于端点的信息。这意味着语音资源客户端将知道如何仅通过密钥和位置连接到语音资源。
我真的很困惑,因为我认为没有端点应该是不可能的。
例如here 使用语音资源的代码示例不使用任何端点(只有一个键和一个位置):
import os
from playsound import playsound
from azure.cognitiveservices.speech import SpeechConfig, SpeechRecognizer, AudioConfig
# Get spoken command from audio file
file_name = 'light-on.wav'
audio_file = os.path.join('data', 'speech', file_name)
# Configure speech recognizer
speech_config = SpeechConfig(cog_key, cog_location)
audio_config = AudioConfig(filename=audio_file) # Use file instead of default (microphone)
speech_recognizer = SpeechRecognizer(speech_config, audio_config)
# Use a one-time, synchronous call to transcribe the speech
speech = speech_recognizer.recognize_once()
# Play the original audio file
playsound(audio_file)
# Show transcribed text from audio file
print(speech.text)
我的意思是我什至无法想象语音资源客户端(由 Microsoft 实现)如何知道它应该连接到我的 Azure 门户中的资源,而不是连接到没有端点的其他门户中的资源。对我来说似乎是一种魔法,所以我肯定在这里遗漏了一些东西。
【问题讨论】:
标签: azure speech-recognition azure-cognitive-services