This repository hosts a script and a Docker-compose setup for performing Optical Character Recognition (OCR) on receipt images.
git clone https://github.com/bhimrazy/receipt-ocr.git
cd receipt-ocr
# 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
main.py
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:
/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'
This project is licensed under the terms of the MIT license.