This project is a FastAPI-based OCR (Optical Character Recognition) API that uses Tesseract-OCR to extract text from images. The API is containerized with Docker, deployed using Portainer, and the image is stored in AWS ECR.
- ✅ FastAPI framework for high-performance API.
- ✅ Tesseract-OCR for optical character recognition.
- ✅ Pre-processing techniques (grayscale, contrast adjustment, binarization).
- ✅ Dockerized application for easy deployment.
- ✅ AWS ECR for container storage.
- ✅ Portainer compatibility for easy management.
- ✅ Optimized Tesseract settings (
--oem 1 --psm 3 -l ita
).
📦 ocr-tesseract ┣ 📂 app ┃┣ 📜 main.py # FastAPI application ┃┗ 📜 ocr.py # OCR processing logic ┣ 📂 infrastructure ┃ ┣ 📜 Dockerfile # Docker setup ┃ ┣ 📜 docker-compose.yml # Container configuration ┃ ┗ 📜 requirements.txt # Python dependencies ┗ 📜 README.md
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r infrastructure/requirements.txt
Instead of running manually, use Docker Compose:
cd infrastructure
docker-compose up --build -d
This will:
Build the Docker image Start the container in detached mode (-d) Expose the API on port 8500