# OCR Service A modular Python service for performing OCR on various documents (Aadhaar, PAN, E-Bills, etc.). ## Project Structure ```text ocr_service/ ├── app_ocr.py # FastAPI entry point ├── src/ │ ├── common/ # Shared utilities (logging, etc.) │ ├── core/ # Document-specific OCR logic │ │ └── aadhaar.py # Aadhaar card processing │ └── utils/ # Helper modules │ ├── address_parser.py │ ├── image.py # Image cleaning & transformation │ └── ocr_engines.py # Pytesseract & EasyOCR wrappers ├── ocr_uploads/ # Temporary storage for uploads └── requirements.txt ``` ## How to Extend To add a new document type (e.g., `pan_ocr`): 1. **Create a Core Module**: Add `src/core/pan.py`. 2. **Implement Logic**: Use the utilities in `src/utils/` for image preprocessing and OCR extraction. 3. **Add Endpoint**: Update `app_ocr.py` to include a new endpoint or update the existing one to route to your new core module. ## Setup 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Create a `.env` file with necessary API keys: - `OPENAI_API_KEY` - `GEMINI_API_KEY` - AWS credentials for CloudWatch logging. 3. Run the service: ```bash python app_ocr.py ```