tf_model / README.md
aryaumesh's picture
Update README.md
7a0a7a5 verified
metadata
license: cc0-1.0

A model that translates English sentences to Hindi.

To use this model, use the following code:

from transformers import AutoTokenizer, TFAutoModelForSeq2SeqLM
model_checkpoint = "aryaumesh/tf_model"

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

text  = "This is a test case."
tokenized = tokenizer([text], return_tensors='np') # Convert input text to numerical format first
out = model.generate(**tokenized, max_length=128) # Performs translation

# Get translated text
with tokenizer.as_target_tokenizer():
    translated_text = tokenizer.decode(out[0], skip_special_tokens=True)
    print(translated_text) # यह एक परीक्षण का मामला है।