The Sanskrit OCR & Translation System is an AI-powered application designed to extract Sanskrit text from:
and automatically translate the extracted text into:
The project combines:
to create a complete Sanskrit document understanding pipeline.
┌──────────────────┐
│ User Upload │
│ Image / PDF File │
└────────┬─────────┘
│
▼
┌──────────────────────┐
│ Image Preprocessing │
│ OpenCV + PIL │
└────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ OCR Engine │
├───────────────────────────┤
│ Printed → Tesseract OCR │
│ Handwritten → TrOCR │
└────────┬──────────────────┘
│
▼
┌──────────────────────┐
│ Text Postprocessing │
└────────┬─────────────┘
│
▼
┌──────────────────────────┐
│ Translation Layer │
│ NLLB-200 Model │
└────────┬─────────────────┘
│
▼
┌──────────────────────────────┐
│ RAG + ChromaDB Retrieval │
└────────┬─────────────────────┘
│
▼
┌───────────────────────────────┐
│ Streamlit Web Interface │
└───────────────────────────────┘
| Component | Technology Used |
|---|---|
| Frontend UI | Streamlit |
| Printed OCR | Tesseract OCR |
| Handwritten OCR | Microsoft TrOCR |
| Translation | Facebook NLLB-200 |
| Image Processing | OpenCV + PIL |
| Deep Learning Framework | PyTorch |
| Transformer Framework | HuggingFace Transformers |
| Vector Database | ChromaDB |
| Embeddings | Sentence Transformers |
| Database | SQLite |
| PDF Processing | pdf2image + Poppler |
| Programming Language | Python |
The printed OCR workflow includes:
The handwritten OCR workflow includes:
MODEL_NAME = "microsoft/trocr-small-handwritten"
If GPU is available, better handwritten OCR performance can be achieved using:
MODEL_NAME = "microsoft/trocr-base-handwritten"
or
MODEL_NAME = "microsoft/trocr-large-handwritten"
The project uses the following multilingual translation model:
facebook/nllb-200-distilled-600M
The system includes a lightweight RAG pipeline for Sanskrit knowledge retrieval.
A synthetic Sanskrit dataset generation pipeline was created using:
Fine-tuning experiments were performed using:
sanskrit_ocr/
│
├── app.py
├── requirements.txt
├── render.yaml
├── apt.txt
│
├── ocr/
│ ├── tesseract_engine.py
│ ├── trocr_engine.py
│ └── preprocess.py
│
├── translation/
│ ├── translate.py
│ └── language_utils.py
│
├── rag/
│ ├── rag_pipeline.py
│ ├── chroma_db/
│ └── corpus_data/
│
├── database/
│ ├── history.db
│ └── history_db.py
│
├── fine_tuning/
│ ├── generate_synthetic.py
│ └── train_trocr.py
│
├── data/
│ ├── fonts/
│ └── synthetic/
│
└── .streamlit/
└── config.toml
git clone https://github.com/avinashsingh539/Sanskrit-ocr.git
cd Sanskrit-ocr
python -m venv .venv
.\.venv\Scripts\Activate.ps1
source .venv/bin/activate
pip install -r requirements.txt
streamlit run app.py
Install Poppler and add:
Library/bin
to system PATH.
sudo apt install poppler-utils
The project is deployment-ready for:
SY Computer Engineering Mini Project
Special thanks to:
4 commits
Python
97.4%
Shell
2.6%
The Sanskrit OCR & Translation System is an AI-powered application designed to extract Sanskrit text from:
and automatically translate the extracted text into:
The project combines:
to create a complete Sanskrit document understanding pipeline.
┌──────────────────┐
│ User Upload │
│ Image / PDF File │
└────────┬─────────┘
│
▼
┌──────────────────────┐
│ Image Preprocessing │
│ OpenCV + PIL │
└────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ OCR Engine │
├───────────────────────────┤
│ Printed → Tesseract OCR │
│ Handwritten → TrOCR │
└────────┬──────────────────┘
│
▼
┌──────────────────────┐
│ Text Postprocessing │
└────────┬─────────────┘
│
▼
┌──────────────────────────┐
│ Translation Layer │
│ NLLB-200 Model │
└────────┬─────────────────┘
│
▼
┌──────────────────────────────┐
│ RAG + ChromaDB Retrieval │
└────────┬─────────────────────┘
│
▼
┌───────────────────────────────┐
│ Streamlit Web Interface │
└───────────────────────────────┘
| Component | Technology Used |
|---|---|
| Frontend UI | Streamlit |
| Printed OCR | Tesseract OCR |
| Handwritten OCR | Microsoft TrOCR |
| Translation | Facebook NLLB-200 |
| Image Processing | OpenCV + PIL |
| Deep Learning Framework | PyTorch |
| Transformer Framework | HuggingFace Transformers |
| Vector Database | ChromaDB |
| Embeddings | Sentence Transformers |
| Database | SQLite |
| PDF Processing | pdf2image + Poppler |
| Programming Language | Python |
The printed OCR workflow includes:
The handwritten OCR workflow includes:
MODEL_NAME = "microsoft/trocr-small-handwritten"
If GPU is available, better handwritten OCR performance can be achieved using:
MODEL_NAME = "microsoft/trocr-base-handwritten"
or
MODEL_NAME = "microsoft/trocr-large-handwritten"
The project uses the following multilingual translation model:
facebook/nllb-200-distilled-600M
The system includes a lightweight RAG pipeline for Sanskrit knowledge retrieval.
A synthetic Sanskrit dataset generation pipeline was created using:
Fine-tuning experiments were performed using:
sanskrit_ocr/
│
├── app.py
├── requirements.txt
├── render.yaml
├── apt.txt
│
├── ocr/
│ ├── tesseract_engine.py
│ ├── trocr_engine.py
│ └── preprocess.py
│
├── translation/
│ ├── translate.py
│ └── language_utils.py
│
├── rag/
│ ├── rag_pipeline.py
│ ├── chroma_db/
│ └── corpus_data/
│
├── database/
│ ├── history.db
│ └── history_db.py
│
├── fine_tuning/
│ ├── generate_synthetic.py
│ └── train_trocr.py
│
├── data/
│ ├── fonts/
│ └── synthetic/
│
└── .streamlit/
└── config.toml
git clone https://github.com/avinashsingh539/Sanskrit-ocr.git
cd Sanskrit-ocr
python -m venv .venv
.\.venv\Scripts\Activate.ps1
source .venv/bin/activate
pip install -r requirements.txt
streamlit run app.py
Install Poppler and add:
Library/bin
to system PATH.
sudo apt install poppler-utils
The project is deployment-ready for:
SY Computer Engineering Mini Project
Special thanks to:
4 commits
Python
97.4%
Shell
2.6%