Verify and Go
Transcription:Batch Real-Time Deployments:Virtual ApplianceThis section explains how to verify the correct operation of the Batch Virtual Appliance using the REST Speech API.
- Batch transcription
- Real-Time transcription
- Method: GET
- URL: http://${APPLIANCE_HOST}:8080/v1/management/services
To run a simple transcription job to test that everything is working use the Batch Virtual Appliance Speech API (on port 8082)
- Method: POST
- URL: http://${APPLIANCE_HOST}:8082/v2/jobs
For example, you can use the following Speech API request using the curl command-line tool to transcribe an audio file 'sample.wav' and return the Job ID:
curl -s -L -X POST 'https://${APPLIANCE_HOST}/v2/jobs/' \
-F data_file=@sample.wav \
-d 'config={ "type": "transcription",
"transcription_config": { "language": "en" }
}' \
| jq
Where ${APPLIANCE_HOST} is the hostname or IP address of your virtual appliance. The above assumes that sample.wav contains English speech; modify the language identifier in the job config to match the language you want to transcribe.
You can use the Job ID to get the status of the job:
curl -s -L -X GET 'https://${APPLIANCE_HOST}/v2/jobs/${JOB_ID}/' \
| jq
Where ${JOB_ID} is the Job ID (id field) that was returned when you submitted the job. Once the job is done, you use the Job ID to return the transcription:
curl -s -L -X GET "https://${APPLIANCE_HOST}/v2/jobs/transcript" \
| jq
Under normal conditions, the job should take less than half the duration of the media file to process. So for example if you submit a MP3 file that is 60 minutes long, its transcription should be processed in less than 30 minutes. See the REST Speech API Guide for the list of language codes, how to use features of the API, the output formats that are supported, as well as more usage examples.
The Speechmatics Batch Virtual Appliance is now ready to use.
The first time that the Real-Time Virtual Appliance is started up there are no persistent workers configured. This means that workers will be spun up dynamically to the limit of the maxworkers limit. If you want to pre-allocate workers so that they are ready for incoming streams, you can select a language to configure as a persistent worker. You can find out the list of available languages on your appliance using the REST API:
- Method: GET
- URL: http://${APPLIANCE_HOST}:8080/v1/management/persistentworkers
This will return as JSON output the list of persistent workers (by language code) and the number of instances; initially they will all be zero. The list of supported languages are available on the Speechmatics website https://www.speechmatics.com/language-support/, or you can consult the release notes.
Use the Management API to set persistent_workers
with a count of at least 1 and the language code to use. For example, to set French as a persistent worker, use the following method:
- Method: POST
- URL: http://${APPLIANCE_HOST}:8080/v1/management/persistentworkers
- Body Format: JSON
- Body:
{ "persistent_workers": [ { "count": "1", "id": "fr" } ] }
This will return an updated list of persistent workers with entry for French (fr) updated to 1.
curl -s -L -X POST "http://${APPLIANCE_HOST}:8080/v1/management/persistentworkers" \
-H 'Accept: application/json' \
-d '{ "persistent_workers":
[ { "count": "1", "id": "fr" } ]
}'
Verify the service
Check that all the Speechmatics services within the appliance are up and running before trying to open a WebSocket connection. The Management API can be used for this.
curl -s -L -X GET "http://${APPLIANCE_HOST}:8080/v1/management/services" \
-H 'Accept: application/json'
Go!
The Real-Time Virtual Appliance is now ready to use.
The Speech API Guide provides details of how to use WebSocket to stream audio to the Speechmatics engine in real time and obtain transcripts. For all WebSocket communication, ensure that the IP address identified in the steps above is used.