Vulavula Translate
Translation
POST
https://vulavula-services.lelapa.ai/api/v1/translate/process.
The Translation endpoint takes the provided text and translates it from the source language to the target language. The maximum text length for each request is 256 words.
BODY PARAMS
input_text string required.
This parameter represents the text input that will be translated from one language to another. It is required for the endpoint to function properly. The input_text
should be provided as a string and contains the text to be processed by the Translation model.
source_lang string required.
This parameter represents the source language of the text that will be translated. It is required for the endpoint to function properly. The source_lang
should be provided as a string.
target_lang string required.
This parameter represents the target language to which the text will be translated. It is required for the endpoint to function properly. The target_lang
should be provided as a string.
HEADERS
X-CLIENT-TOKEN string required.
Represents the authentication token required for accessing the API. This header ensures that only authorized clients can make requests to the endpoint.
EXAMPLES
- Python SDK
- Python HTTP
- Curl
pdm add vulavula
from vulavula import VulavulaClient
client = VulavulaClient("<INSERT_TOKEN>")
translation_data = {
"input_text": "Lo musho ubhalwe ngesiZulu.",
"source_lang": "zul_Latn",
"target_lang": "eng_Latn"
}
translation_result = client.translate(translation_data)
print("Translation Result:", translation_result)
You can also translate to other languages by changing the source_lang
and target_lang
parameter:
- Northern Sotho (nso_Latn)
- Afrikaans (afr_Latn)
- Southern Sotho (sot_Latn)
- Swati (ssw_Latn)
- Tsonga (tso_Latn)
- Tswana (tsn_Latn)
- Xhosa (xho_Latn)
- Zulu (zul_Latn)
- English (eng_Latn)
- Swahili (swh_Latn)
- Shona (sna_Latn)
# Endpoint URL
import requests
url = 'https://vulavula-services.lelapa.ai/api/v1/translate/process'
# Headers
headers = {
'Content-Type': 'application/json',
'X-CLIENT-TOKEN': '<INSERT_TOKEN>' # Replace '<INSERT_TOKEN>' with your actual client token
}
# Request body
data = {
"input_text": "Lo musho ubhalwe ngesiZulu.",
"source_lang": "zul_Latn",
"target_lang": "eng_Latn"
}
# Sending POST request
response = requests.post(url, headers=headers, json=data)
# Printing response
print(response.json())
'https://vulavula-services.lelapa.ai/api/v1/translate/process' \
-H 'accept: application/json' \
-H 'X-CLIENT-TOKEN: <INSERT_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"input_text": "Lo musho ubhalwe ngesiZulu",
"source_lang": "zul_Latn",
"target_lang": "eng_Latn"
}'
RESPONSES
🟢 200 OK
{
"id": "deed7995-dcf4-4456-bd33-c92ca1d990ca",
"translation": [
{
"translated_text": "This sentence is written in Zulu."
}
]
}
RESPONSE BODY PARAMS
Object |
---|
translation array required. An array containing the translated text. |
translated_text string required. Contains the translated text. |