english-to-tamil / README.md
aryaumesh's picture
Update README.md
5d0ba54 verified
metadata
license: cc0-1.0

A model that translates English sentences to Tamil.

To use this model, use the following code:

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model_checkpoint = "aryaumesh/english-to-tamil"

tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)

def language_translator(text):
    tokenized = tokenizer([text], return_tensors='pt')
    out = model.generate(**tokenized, max_length=128)
    return tokenizer.decode(out[0],skip_special_tokens=True)

text_to_translate = "This is a test case." # Sentence to translate
output = language_translator(text_to_translate)
print(output) # இது ஒரு சோதனை வழக்கு.