Logo Lanfrica

africa-ai/vlm

Domain:

natural language processing

Record type:

software
Creator:
afr
Host:
# Kalenjin Dictionary OCR & Extraction A clean and efficient pipeline to extract dictionary entries from PDF documents using OCR and language models. ## Architecture **Simple Pipeline: PDF → Images → OCR → vLLM → JSON** 1. **PDF to Images**: Convert PDF pages to PNG images using PyMuPDF 2. **OCR**: Extract raw text using pytesseract (Tesseract OCR) 3. **vLLM Server**: Process extracted text with NVIDIA Cosmos-Reason1-7B to structure dictionary entries 4. **JSON Output**: Clean dictionary entries with translations and metadata ## Why This Approach? - **Simple & Effective**: OCR extracts text cleanly, LLM structures it perfectly - **Fast Processing**: No complex image preprocessing or vision model overhead - **Reliable Results**: OCR is mature technology, LLM excels at text structuring - **Resource Efficient**: Uses GPU only for LLM text processing, not image analysis ## Quick Start ### 1. Install Dependencies ```bash python install.py ``` This installs: - pytesseract + tesseract OCR engine - vLLM server with CUDA support - PDF processing utilities ### 2. Start vLLM Server ```bash python start_vllm_server.py ``` Starts NVIDIA Cosmos-Reason1-7B model server with: - Multi-GPU tensor parallelism (if available) - OpenAI-compatible API endpoints - Optimized CUDA kernels for fast inference ### 3. Process Dictionary ```bash # Full pipeline (recommended) python main.py pipeline kalenjin_dictionary.pdf --output ./results # Or step by step python main.py images kalenjin_dictionary.pdf --output ./results python main.py ocr ./results/images --output ./results ``` ## Features ### Core Capabilities - **Clean Text Extraction**: pytesseract OCR for reliable text extraction - **Intelligent Structuring**: vLLM server processes OCR text into structured entries - **Batch Processing**: Handle multiple pages efficiently - **Real-time Progress**: Monitor extraction with live result files ### Technical Features - **GPU Accelerated**: vLLM server with multi-GPU support (2×A10G t …