# AI Receipt Parser ## Introduction AI Receipt Parser is an intelligent solution designed to automate the extraction and organization of data from receipt images. Whether for businesses or individuals, this tool eliminates the tedious process of manual data entry, allowing users to focus on insights and decision-making. This application leverages **OCR (Optical Character Recognition)** technology and **AI-driven processing** to convert receipt images into structured, actionable data. > Inspired by [@IAmTomShaw](https://github.com/IAmTomShaw)'s **Receipt Vision**. ## 🚀 Features - **Receipt Image Upload** – Users can upload receipt images for automatic processing. - **OCR Technology** – Extracts text from images using **Tesseract OCR**. - **AI-Powered Parsing** – Uses **OpenAI's GPT-4** to structure the extracted text into JSON format. - **Database Integration** – Stores parsed data in a **MySQL database** for persistence. - **Web Interface** – Provides an interactive UI for uploading, viewing, and managing receipts. - **Receipt Breakdown** – Displays product details, prices, and categories from receipts. ## 🖥️ Tech Stack | Component | Technology | |------------|-------------| | **Backend** | Flask (Python) | | **Frontend** | HTML, CSS, Bootstrap, JavaScript | | **Database** | MySQL | | **AI Integration** | OpenAI GPT-4 API | | **OCR** | Tesseract | --- ## ⚡ Getting Started ### Prerequisites - Python **3.10+** - MySQL Server **8.0+** - OpenAI API Key ### Installation #### 1️⃣ Clone the Repository ```sh git clone https://github.com/JustCabaret/receipt-parser.git cd receipt-parser
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Run the following SQL script on your MySQL server:
CREATE DATABASE receiptparserdb; USE receiptparserdb; CREATE TABLE receipts ( id INT AUTO_INCREMENT PRIMARY KEY, total INT NOT NULL, source VARCHAR(255) NOT NULL, parsed_at DATETIME DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE receipt_items ( id INT AUTO_INCREMENT PRIMARY KEY, receipt_id INT NOT NULL, product VARCHAR(255) NOT NULL, quantity INT NOT NULL, price INT NOT NULL, category VARCHAR(50) DEFAULT NULL, FOREIGN KEY (receipt_id) REFERENCES receipts(id) );
Edit database.py
with your MySQL connection details:
mysql.connector.connect( host="127.0.0.1", user="your_username", password="your_password", database="receiptparserdb" )
python app.py
The server will run at: http://127.0.0.1:5000.
Open http://127.0.0.1:5000 in your browser.
Use the upload interface to submit receipt images.
Processed receipts will appear in the main table, showing the total price and store name.
Click on any receipt to see products, quantities, prices, and categories.
Method | Endpoint | Description |
---|---|---|
POST | /process_receipt | Upload and process a receipt image |
GET | /receipts | Retrieve all processed receipts |
GET | /receipts/{receipt_id} | Get details of a specific receipt |
{ "total": 1250, "store": "SuperMart", "items": [ {"product": "Milk", "quantity": 2, "price": 250, "type": "Groceries"}, {"product": "Bread", "quantity": 1, "price": 150, "type": "Groceries"} ] }
JustCabaret – GitHub Profile
This project is licensed under the MIT License – see the LICENSE file for details.
There are no models linked
There are no datasets linked
There are no datasets linked
There are no models linked