This repository hosts a script and a Docker-compose setup for performing Optical Character Recognition (OCR) on receipt images.
- Python 3.x
- Docker
- Docker-compose
git clone https://github.com/bhimrazy/receipt-ocr.git
cd receipt-ocr
- Install tesseract
# Create and activate a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # For Windows, use venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
The main.py
script performs OCR on an input image of a receipt.
python main.py -i images/receipt.jpg
Replace images/receipt.jpg
with the path to your receipt image.
Please ensure that the image is well-lit and that the edges of the receipt are clearly visible and detectable within the image.
The repository includes a Docker-compose setup for running the OCR engine as a service.
docker-compose up
Once the service is up and running, you can perform OCR on receipt images by sending a POST request to http://localhost:8000/ocr/
with the image file.
The OCR functionality can be accessed via a FastAPI endpoint:
- POST
/ocr/
: Upload a receipt image file to perform OCR. The response will contain the extracted text from the receipt.
Example usage with cURL:
curl -X 'POST' \
'http://localhost:8000/ocr/' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@images/paper-cash-sell-receipt-vector-23876532.jpg;type=image/jpeg'
- Gemini Docs:https://ai.google.dev/tutorials/python_quickstart
- LinkedIn Post: https://www.linkedin.com/feed/update/urn:li:activity:7145860319150505984/
This project is licensed under the terms of the MIT license.