Transcribe long files
In this example, we will transcribe a long audio file (> 60 seconds) using the asynchronous API.
For shorter audio files (<60 seconds), please refer to the Transcribe Short Audio guide which uses the synchronous API for simplicity.
Upload file
First we upload the file with the transcribe_file_async()
function.
Once the request succeeds, the auto-assigned file_id
is returned.
You can use the reference_name
to associate your internal file id with the uploaded file.
It can be any string not longer than 256 characters, including the empty string, and duplicates are allowed.
The service does not use this field, it is only for your reference.
Get status
After the file has been uploaded, it will be in one of 4 states: QUEUED
, TRANSCRIBING
, COMPLETED
or FAILED
.
We call the GetTranscribeAsyncStatus()
function to check the status of the file.
If the file status is FAILED
, the error message can be obtained from error_message
field.
Get result
Once the file status is COMPLETED
, we call the GetTranscribeAsyncResult()
function to retrieve transcription result.
Note, when transcribing with separate recognition per channel, the GetTranscribeAsyncResult()
function
returns a list of results, one for each channel.
Delete file
Once the transcription result has been obtained, the file should be deleted using DeleteTranscribeAsyncFile
function.
Run
Run the complete example transcribe_file_async.py.
Output