IqbalHere/Meme-Karigar

Meme Karigar

0

stars

7

commits

Python

primary language

Jul 11, 2026

updated

README

Python PyTorch Transformers IndicNLP License

A fast Python translation pipeline for converting English text into Indic languages using IndicTrans2 with robust preprocessing and postprocessing.

πŸš€ Quick Start β€’ πŸ“– Docs β€’ πŸ”§ Config β€’ 🀝 Contributing

✨ Why Meme Karigar?

🌍English β†’ Indic translation
Uses ai4bharat/indictrans2-en-indic-dist-200M for multilingual translation from English to Indic scripts.
βš™οΈInference-ready text pipeline
Preprocesses punctuation, tokenization, and language tags before generation.
πŸ›‘οΈPlaceholder preservation
Protects URLs, emails, numerals, and tagged entities during translation and restores them after decoding.
πŸš€GPU/CPU adaptive runtime
Automatically picks CUDA when available and falls back to CPU otherwise.
🧩Reusable API function
Simple translate_text(...) interface for scripts and downstream integrations.

πŸ—οΈ Architecture

graph LR
    A[πŸ“ Input Text] --> B[🧹 IndicProcessor Preprocess]
    B --> C[πŸ”€ Tokenizer]
    C --> D[πŸ€– IndicTrans2 Model]
    D --> E[πŸ“€ Decode + Postprocess]
    E --> F[βœ… Translated Output]

    style A fill:#6C63FF,color:#fff,stroke:#4C46B8
    style B fill:#A855F7,color:#fff,stroke:#7E22CE
    style C fill:#F59E0B,color:#111,stroke:#B45309
    style D fill:#10B981,color:#fff,stroke:#047857
    style E fill:#EF4444,color:#fff,stroke:#B91C1C
    style F fill:#6C63FF,color:#fff,stroke:#4C46B8

πŸ“¦ Prerequisites

RequirementBadgeNotes
PythonPythonRuntime for scripts
PyTorchPyTorchModel execution backend
TransformersTransformersModel and tokenizer loading

πŸš€ Quick Start

1️⃣ Clone repository

git clone https://github.com/IqbalHere/Meme-Karigar.git
cd Meme-Karigar

2️⃣ Create and activate virtual environment

macOS/Linux
python -m venv .venv
source .venv/bin/activate
Windows
python -m venv .venv
.venv\Scripts\activate

3️⃣ Install dependencies

pip install torch transformers indic-nlp-library sacremoses regex tqdm

4️⃣ Run sample translation

python /home/runner/work/Meme-Karigar/Meme-Karigar/test_translation.py

[!TIP] First run may take longer because model weights are downloaded from Hugging Face.

πŸ”§ Configuration

VariableRequiredDescription
src_langβœ…Source FLORES code passed to translate_text (default: eng_Latn)
tgt_langβœ…Target FLORES code passed to translate_text (example: tel_Telu)
textβœ…Input string to translate

[!NOTE] This repository currently uses function parameters for configuration; no environment variable is required by the checked-in Python code.

πŸ“š API / Tool Reference

ParameterTypeRequiredDefaultDescription
textstrβœ…β€”Input sentence/text
src_langstr❌eng_LatnSource language FLORES code
tgt_langstr❌tel_TeluTarget language FLORES code

Example structured output:

{
  "translated_text": "ΰ°‡ΰ°¦ΰ°Ώ ΰ°ͺరీక్ష.",
  "source_language": "eng_Latn",
  "target_language": "tel_Telu"
}

πŸ›‘οΈ Error Handling

ScenarioBehavior
⚠️ Unsupported FLORES mappingFalls back to default ISO behavior where applicable in IndicProcessor (hi)
❌ Model/tokenizer load issueRaises dependency/runtime exception from Transformers/PyTorch
πŸ”Œ No CUDA availableAutomatically runs on CPU

🧰 Development

Dev commands

# Run translation smoke test
python /home/runner/work/Meme-Karigar/Meme-Karigar/test_translation.py

Project structure

πŸ“¦ Meme-Karigar
β”œβ”€β”€ πŸ“„ README.md
β”œβ”€β”€ πŸ“„ translator.py
β”œβ”€β”€ πŸ“„ indic_processor.py
β”œβ”€β”€ πŸ“„ test_translation.py
β”œβ”€β”€ πŸ“„ output.txt
└── πŸ“„ useme.txt

πŸ› οΈ Tech Stack

TechnologyRole
PythonCore implementation language
PyTorchTensor runtime for inference
TransformersPretrained model/tokenizer APIs
IndicNLPIndic normalization/tokenization/transliteration
SacremosesEnglish punctuation normalization/tokenization

🀝 Contributing

  1. Fork this repository
  2. Create a branch (git checkout -b feature/your-change)
  3. Commit your work (git commit -m "feat: describe your change")
  4. Push your branch (git push origin feature/your-change)
  5. Open a Pull Request

πŸ“œ License

License file is not currently present in this repository.

[!IMPORTANT] Add a /LICENSE file to clearly define usage rights for contributors and users.

Built with ❀️ by Iqbal

Stars Forks Issues

⭐ Star this repo if you found it useful! ⭐

Contributors

IqbalHere

6 commits

Copilot

1 commits

IqbalHere/Meme-Karigar

Meme Karigar

0

stars

7

commits

Python

primary language

Jul 11, 2026

updated

README

Python PyTorch Transformers IndicNLP License

A fast Python translation pipeline for converting English text into Indic languages using IndicTrans2 with robust preprocessing and postprocessing.

πŸš€ Quick Start β€’ πŸ“– Docs β€’ πŸ”§ Config β€’ 🀝 Contributing

✨ Why Meme Karigar?

🌍English β†’ Indic translation
Uses ai4bharat/indictrans2-en-indic-dist-200M for multilingual translation from English to Indic scripts.
βš™οΈInference-ready text pipeline
Preprocesses punctuation, tokenization, and language tags before generation.
πŸ›‘οΈPlaceholder preservation
Protects URLs, emails, numerals, and tagged entities during translation and restores them after decoding.
πŸš€GPU/CPU adaptive runtime
Automatically picks CUDA when available and falls back to CPU otherwise.
🧩Reusable API function
Simple translate_text(...) interface for scripts and downstream integrations.

πŸ—οΈ Architecture

graph LR
    A[πŸ“ Input Text] --> B[🧹 IndicProcessor Preprocess]
    B --> C[πŸ”€ Tokenizer]
    C --> D[πŸ€– IndicTrans2 Model]
    D --> E[πŸ“€ Decode + Postprocess]
    E --> F[βœ… Translated Output]

    style A fill:#6C63FF,color:#fff,stroke:#4C46B8
    style B fill:#A855F7,color:#fff,stroke:#7E22CE
    style C fill:#F59E0B,color:#111,stroke:#B45309
    style D fill:#10B981,color:#fff,stroke:#047857
    style E fill:#EF4444,color:#fff,stroke:#B91C1C
    style F fill:#6C63FF,color:#fff,stroke:#4C46B8

πŸ“¦ Prerequisites

RequirementBadgeNotes
PythonPythonRuntime for scripts
PyTorchPyTorchModel execution backend
TransformersTransformersModel and tokenizer loading

πŸš€ Quick Start

1️⃣ Clone repository

git clone https://github.com/IqbalHere/Meme-Karigar.git
cd Meme-Karigar

2️⃣ Create and activate virtual environment

macOS/Linux
python -m venv .venv
source .venv/bin/activate
Windows
python -m venv .venv
.venv\Scripts\activate

3️⃣ Install dependencies

pip install torch transformers indic-nlp-library sacremoses regex tqdm

4️⃣ Run sample translation

python /home/runner/work/Meme-Karigar/Meme-Karigar/test_translation.py

[!TIP] First run may take longer because model weights are downloaded from Hugging Face.

πŸ”§ Configuration

VariableRequiredDescription
src_langβœ…Source FLORES code passed to translate_text (default: eng_Latn)
tgt_langβœ…Target FLORES code passed to translate_text (example: tel_Telu)
textβœ…Input string to translate

[!NOTE] This repository currently uses function parameters for configuration; no environment variable is required by the checked-in Python code.

πŸ“š API / Tool Reference

ParameterTypeRequiredDefaultDescription
textstrβœ…β€”Input sentence/text
src_langstr❌eng_LatnSource language FLORES code
tgt_langstr❌tel_TeluTarget language FLORES code

Example structured output:

{
  "translated_text": "ΰ°‡ΰ°¦ΰ°Ώ ΰ°ͺరీక్ష.",
  "source_language": "eng_Latn",
  "target_language": "tel_Telu"
}

πŸ›‘οΈ Error Handling

ScenarioBehavior
⚠️ Unsupported FLORES mappingFalls back to default ISO behavior where applicable in IndicProcessor (hi)
❌ Model/tokenizer load issueRaises dependency/runtime exception from Transformers/PyTorch
πŸ”Œ No CUDA availableAutomatically runs on CPU

🧰 Development

Dev commands

# Run translation smoke test
python /home/runner/work/Meme-Karigar/Meme-Karigar/test_translation.py

Project structure

πŸ“¦ Meme-Karigar
β”œβ”€β”€ πŸ“„ README.md
β”œβ”€β”€ πŸ“„ translator.py
β”œβ”€β”€ πŸ“„ indic_processor.py
β”œβ”€β”€ πŸ“„ test_translation.py
β”œβ”€β”€ πŸ“„ output.txt
└── πŸ“„ useme.txt

πŸ› οΈ Tech Stack

TechnologyRole
PythonCore implementation language
PyTorchTensor runtime for inference
TransformersPretrained model/tokenizer APIs
IndicNLPIndic normalization/tokenization/transliteration
SacremosesEnglish punctuation normalization/tokenization

🀝 Contributing

  1. Fork this repository
  2. Create a branch (git checkout -b feature/your-change)
  3. Commit your work (git commit -m "feat: describe your change")
  4. Push your branch (git push origin feature/your-change)
  5. Open a Pull Request

πŸ“œ License

License file is not currently present in this repository.

[!IMPORTANT] Add a /LICENSE file to clearly define usage rights for contributors and users.

Built with ❀️ by Iqbal

Stars Forks Issues

⭐ Star this repo if you found it useful! ⭐

Contributors

IqbalHere

6 commits

Copilot

1 commits

Languages

Python

100.0%