I m tryting to use the Batch transcription of Microsoft Azure. following the Official documentation I guess should be like this:
- I send the Audio to the service (POST)
- Get results. (GET with parameters of the post)
but I m not getting anything.
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)
With the results of the post I build my GET methode.
response2 = requests.request("GET", json.loads(response.text)["links"]["files"], headers=headers, data={})
when I check the results of response2, there is a "contentURL" where I imagine could be the results
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>'}}]}
Checking the "contentUrl" manually (copy paste in my browser) I get the error "errorMessage": "Error when downloading the recording URI. StatusCode: Conflict."
I dont know what I m doing wrong, how can I get the results(the transcription) ?
CodePudding user response:
In the end I have opened a ticket with microsoft and after analysis the problem was in part of our infrastructure.
"We are getting the error of the issue because the audio file is not publicly accessible and therefore not downloadable by the Speech service"
"The service needs to be able to download the file and therefore you need to generate a SAS URL for it"