我正在尝试使用 Microsoft Azure 的批量转录。 关注官方documentation 我想应该是这样的:
- 我将音频发送到服务 (POST)
- 获取结果。 (使用帖子的参数获取)
但我什么也没得到。
1)
url_endpoint = "https://westeurope.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/"
payload = json.dumps({
"contentUrls": <url of my oudio.mp3>,
"properties": {
"wordLevelTimestampsEnabled": True
},
"locale": "en-US",
"displayName": "Testing if works"
})
headers = {
'Ocp-Apim-Subscription-Key': my_subscription_key,
'Content-Type': 'application/json'
}
response = requests.request("POST", url_endpoint, headers=headers, data=payload)
根据这篇文章的结果,我构建了我的 GET 方法。
response2 = requests.request("GET", json.loads(response.text)["links"]["files"], headers=headers, data={})
当我检查response2的结果时,有一个“contentURL”,我认为这可能是结果
r
esponse2.json()
{'values': [{'self': 'https://westeurope.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/<id_of_my_transcription>',
'name': 'report.json',
'kind': 'TranscriptionReport',
'properties': {'size': 399},
'createdDateTime': '2022-09-01T09:51:10Z',
'links': {'contentUrl': 'https://spsvcprodweu.blob.core.windows.net/<values>'}}]}
手动检查“contentUrl”(在浏览器中复制粘贴)时收到错误“errorMessage”:“下载录制 URI 时出错。状态代码:冲突。”
我不知道我做错了什么,我怎样才能得到结果(转录)?
最佳答案
最后,我向微软开了一张票,经过分析,问题出在我们基础设施的一部分。
“我们收到此问题的错误是因为音频文件不可公开访问,因此语音服务无法下载”
“该服务需要能够下载该文件,因此您需要为其生成 SAS URL”
关于Azure Batch 转录 : Error when downloading the recording URI. 状态代码:冲突(下载失败),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73567966/