MT (Text-to-Text)¶
The endpoint for the Machine Translation service is https://asr.iitm.ac.in/internal/mt/translate. This API supports the translation services via a LoRA finetuned NLLB model trained at our SPRING lab on Technical domain-specific data from NPTEL.
Request keys¶
Key | Description |
---|---|
src_language |
source language of the text to be translated in lowercase (eg:
hindi , telugu ). Default option: english .
|
tgt_language |
target language to which the input data is to be translated into. all
in lowercase (eg: sanskrit , urdu ). Default option:
english . |
transcript (optional) |
source text being passed for translation. |
source_vtt (optional) |
data being passed for translation as a string, but with captions as
in a .vtt file. Each segment/caption of the vtt is translated
independently. |
translator_choice |
the translator option being chosen to translate the input. Choose
from iiit-h , Finetuned_NLLB . Default option:
Finetuned_NLLB . |
Response keys¶
Upon successful service of the request, the API returns a JSON response with the following keys:
Key | Description |
---|---|
status |
success |
mt_out |
If the transcript key is passed with some text in the
request, mt_out would carry the translation of the same. |
translated_vtt |
If the source_vtt key is passed with vtt content in the
request, translated_vtt would carry the translation of each of the
captions in the source_vtt and returns the translated vtt content.
|
transcript |
If the transcript key is passed with some text in the
request, additional punctuations would have been incorporated into the text and
the richer text is returned. |
source_vtt |
If the source_vtt key is passed with vtt content in the
request, additional punctuations would have been added to each of the captions
in the source_vtt and the richer source vtt content is returned.
|
In case of a service failure, the API returns a JSON response with the following keys:
Key | Description |
---|---|
status |
failure |
reason |
a reason for the failure in serving the request |
Language pairs supported by iiit-h
¶
- English → Gujarati
- English → Hindi
- English → Punjabi
- English → Tamil
- English → Telugu
- Hindi → Bangla
- Hindi → Gujarati
- Hindi → Punjabi
- Hindi → Tamil
- Hindi → Telugu
- Marathi → English
- Marathi → Hindi
- Gujarati → Hindi
Language pairs supported by
Finetuned_NLLB
¶
The NLLB model from
Meta AI supports 200
languages. Every possible set of language pairs from the below set is supported by
the Finetuned_NLLB
translator choice.
Usage¶
import requests
text = "सुप्रभात. आईआईटी मद्रास में आपका स्वागत है। "
payload = {
'src_language': 'hindi',
'tgt_language': 'english',
'transcript': text,
'source_vtt': None,
'translator_choice': 'Finetuned_NLLB'
}
response = requests.post('https://asr.iitm.ac.in/internal/mt/translate', data = payload).json()
print(response)
Web Demo interface for the NLLB model is available at https://asr.iitm.ac.in/demo/ttt
Created: March 24, 2023