Downloads · 30 days
11
12% of all-time downloads
nandakishoresaic/indian-news-translator
indian-news-translator is a translation model from nandakishoresaic. Use it when you need text moved from one language to another. The card lists the license as cc-by-nc-4.0.
Translate news articles from ANY source into 10 languages instantly!
Downloads · 30 days
11
12% of all-time downloads
All-time downloads
91
Public
Parameters
615M
2.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.5 GB · 99%
From the Hugging Face model README
Translate news articles from ANY source into 10 languages instantly!
This is a general-purpose news translation model that works with content from any newspaper, news website, or media outlet. No specific data sources are used - this is a pre-trained multilingual model suitable for translating journalistic content.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Load model
model_name = "YOUR_USERNAME/multilingual-news-translator"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Translate to Hindi
text = "Global markets showed strong growth today"
tokenizer.src_lang = "eng_Latn"
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(
**inputs,
forced_bos_token_id=tokenizer.lang_code_to_id["hin_Deva"],
max_length=512
)
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(translation)
| Language | Code | Script |
|---|---|---|
| English | eng_Latn | Source language |
| Hindi | hin_Deva | देवनागरी |
| Telugu | tel_Telu | తెలుగు |
| Tamil | tam_Taml | தமிழ் |
| Kannada | kan_Knda | ಕನ್ನಡ |
| Bengali | ben_Beng | বাংলা |
| Malayalam | mal_Mlym | മലയാളം |
| Spanish | spa_Latn | Latin |
| French | fra_Latn | Latin |
| Japanese | jpn_Jpan | 日本語 |
| Chinese | zho_Hans | 简体中文 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
class NewsTranslator:
def __init__(self, model_name):
self.tokenizer = AutoTokenizer.from_pretrained(model_name)
self.model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
self.languages = {
'hindi': 'hin_Deva',
'tamil': 'tam_Taml',
'spanish': 'spa_Latn',
'french': 'fra_Latn'
}
def translate(self, text, target_lang):
self.tokenizer.src_lang = "eng_Latn"
inputs = self.tokenizer(text, return_tensors="pt", truncation=True)
outputs = self.model.generate(
**inputs,
forced_bos_token_id=self.tokenizer.lang_code_to_id[self.languages[target_lang]],
max_length=512,
num_beams=5
)
return self.tokenizer.decode(outputs[0], skip_special_tokens=True)
# Usage
translator = NewsTranslator("YOUR_USERNAME/multilingual-news-translator")
result = translator.translate("Breaking news from around the world", "hindi")
print(result)
⚠️ Important: This model does NOT contain data from any specific news organization. It is a general-purpose translation model trained on public multilingual data. Users are responsible for respecting copyright when translating content from specific sources.
Built using Meta's NLLB-200 (No Language Left Behind) model
Made with ❤️ for the global news community