Posted August 12, 2024Aug 12 Transcribing an Audio File from a Storage Account Using the Speech Service UseCase 1 – Azure Speech Service Outbound access not restricted [ATTACH type=full" alt="Shikhaghildiyal_0-1722669169760.png]62496[/ATTACH] Prepare the Audio File: Upload the audio file to your storage account and note its URL. We can take sample file from here: cognitive-services-speech-sdk/sampledata/audiofiles at master · Azure-Samples/cognitive-services-speech-sdk · GitHub Set Up the Speech Service: Obtain the API key and endpoint URL from your speech service in Azure as below reference [ATTACH type=full" alt="Shikhaghildiyal_1-1722669224753.png]62497[/ATTACH] 3. Make the GET Request: Follow below steps in Postman to make a POST request to Speech Service Open Postman and create a new POST request. Set the URL to https://<SpeechServiceLocation>.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions. Add Headers: Ocp-Apim-Subscription-Key: <keyOfSpeechService> Content-Type: application/json Set the Body to raw and select JSON format. Then, paste the following JSON: { "contentUrls": [ "SASLinkToAudioFileOnStorage" ], "locale": "en-US", "displayName": "My Transcription", "model": null, "properties": { "wordLevelTimestampsEnabled": true, "languageIdentification": { "candidateLocales": [ "en-US", "de-DE", "es-ES" ] } } } The Post Request will return a status code of 201 as shown – it indicates that the request was successfully processed, and a new transcription job has been created. This status code confirms that the transcription process has been initiated [ATTACH type=full" alt="Shikhaghildiyal_3-1722669378960.png]62498[/ATTACH] In the response body of the POST request, find the URL provided under the ‘Links’ section and make a GET request to that URL. [ATTACH type=full" alt="Shikhaghildiyal_4-1722669401980.png]62499[/ATTACH] The response from this GET request will contain a contentUrl, which you need to use to make another request to fetch the transcribed data [ATTACH type=full" alt="Shikhaghildiyal_7-1722669523462.png]62500[/ATTACH] Since the outbound access was not disabled, we were able to fetch the Transcribed data from speech service. [ATTACH type=full" alt="Shikhaghildiyal_8-1722669551448.png]62501[/ATTACH] UseCase 2 – Azure Speech Service Outbound access is restricted [ATTACH type=full" alt="Shikhaghildiyal_9-1722669583072.png]62502[/ATTACH] Repeat the steps as mentioned in UseCase1 to send POST request to Speech Service. The request will return a status code of 403.This means that we are not allowed to access Audio File from Storage account because here we have mentioned - restrictOutboundNetworkAccess": true, and "allowedFqdnList": "microsoft.com" which means we have restricted outbound access and speech service can only access “microsoft.com” only. [ATTACH type=full" alt="Shikhaghildiyal_10-1722669602968.png]62503[/ATTACH] Continue reading...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.