Sync Transcription
Transcribe V1 has been deprecated!
The Transcribe V1 endpoint has been deprecated and will be removed in a future release. This documentation has been updated to reference the newer v2alpha API, which includes improvements and ongoing support. If you're still using V1, we recommend migrating to v2alpha as soon as possible to ensure continued functionality. API Reference
POST
https://vulavula-services.lelapa.ai/api/v2alpha/transcribe/sync
The sync
endpoint enables users to run transcription and receive results immediately. You submit an audio file as a blob and wait synchronously for the result, which is returned once the HTTP request completes.
BODY PARAMS
file_name string required
The name of the file. (Note: I think this will be changing really soon)
audio_blob Blob/string of bytes required
Blob or string of bytes of the file. The string of bytes should be base64 encoded.
file_size int64 required
The size of the file. The file size should not exceed 1GB.
The parameter is no longer used, but is still not optional! You can default a value like 0.
language_code string optional
Additionally, optionally, you can specify a language code to specify which model you’re speaking on. The following language codes are valid:
- Afrikaans = "afr"
- isiZulu = "zul"
- Sesotho = "sot"
HEADERS
X-CLIENT-TOKEN string required
API token generated for the project.
import requests import base64 try: #file path FILE_TO_TRANSCRIBE = "<<AUDIO FILE PATH>>" # Open file in binary mode with open(FILE_TO_TRANSCRIBE, 'rb') as file: # Read file file_content = file.read() # Encode file content encoded_content = base64.b64encode(file_content) # Decode bytes to string encoded_string = encoded_content.decode('utf-8') request_body_json = { "file_name": FILE_TO_TRANSCRIBE, "audio_blob": encoded_string, "file_size": 0, # this parameter is no longer used, but is still not optional! sorry! } headers={ "X-CLIENT-TOKEN": "<INSERT_TOKEN>", } response = requests.post( "https://vulavula-services.lelapa.ai/api/v2alpha/transcribe/sync", json=request_body_json, headers=headers, ) except ValueError: print("Response is not in JSON format")python
# Handling the response # Get the status code print(f'Status Code: {response.status_code}') # If the response is in JSON format, you can get it as a dictionary: response_json = response.json() # Converts response to JSON format print(f'Response JSON: {response_json}')python
RESPONSES
🟢 200 OK
{ "message": "success", "transcription_text": "sikubingelele esikomkene ndabenzehoranokqale mini sibingelelenakuwe ska holele ni lotholhlalo zohlakazi at itithi lezindabani", "language_id": "sot" }json
RESPONSE BODY PARAMS
Object |
---|
message string required. A status message indicating the success of the transcription request. |
text string required. The transcribed text of the provided audio file. |
language_id string required. The language code representing the detected language of the transcription, in this case, "sot" for Sesotho. |