Downloads · 30 days
13
50% of all-time downloads
Krupa22/hindi-slang-model
hindi-slang-model is a machine learning model from Krupa22. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a pre-trained machine translation model for translating text from Hindi to English. The model is based on the Helsinki-NLP/opus-mt-hi-en model, utilizing the Transformers framework.
Downloads · 30 days
13
50% of all-time downloads
All-time downloads
26
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.8 KB · 49%
From the Hugging Face model README
This repository contains a pre-trained machine translation model for translating text from Hindi to English. The model is based on the Helsinki-NLP/opus-mt-hi-en model, utilizing the Transformers framework.
To use this model, install the required dependencies:
pip install transformers torch
You can use this model with the Hugging Face transformers library as follows:
from transformers import MarianMTModel, MarianTokenizer
def translate(text):
model_name = "Helsinki-NLP/opus-mt-hi-en"
tokenizer = MarianTokenizer.from_pretrained(model_name)
model = MarianMTModel.from_pretrained(model_name)
# Tokenize input text
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
# Generate translation
translated_tokens = model.generate(**inputs)
translation = tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)
return translation[0]
# Example usage
hindi_text = "\u092e\u0947\u0930\u093e \u0928\u093e\u092e \u0930\u093e\u0939\u0941\u0932 \u0939\u0948"
english_translation = translate(hindi_text)
print("Translation:", english_translation)
This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.
transformers library.