Azure Batch 转录 : Error when downloading the recording URI. 状态代码:冲突(下载失败)

标签 azure post speech-to-text azure-cognitive-services azure-speech

我正在尝试使用 Microsoft Azure 的批量转录。 关注官方documentation 我想应该是这样的:

  1. 我将音频发送到服务 (POST)
  2. 获取结果。 (使用帖子的参数获取)

但我什么也没得到。

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/

相关文章:

sql-server - Azure 托管实例无法创建或还原数据库

javascript - Microsoft Bot Framework 请求中的 MissingProperty 错误

django - POST 请求时出现 DRF "field is required"错误?

speech-to-text - 使用 Bing Speech API(语音到文本)转录 MP3 音频文件

c# - 如果另一条消息即将说出,如何停止 SpeakAsync?

java - Android 语音关闭数字识别

c# - 是否可以在 Azure 函数中保留环境设置?

python - 为azure python delete_by_id方法获取正确的api版本

html - POST 未选中的 HTML 复选框

c# - 使用 WebClient、DownloadData 方法和自定义 header 发布到网页