A machine learning–based system that automatically extracts text from invoices, processes it using NLP, and classifies invoices into categories such as Rent, Utilities, Supplies, etc.
It provides a REST API for uploading invoices and retrieving classified results, and securely stores all data in a database for analysis.
This project demonstrates how to build an end-to-end invoice classification system using:
- OCR (Tesseract) to extract text from PDFs
- NLP + Machine Learning to classify text into categories
- Flask REST API to expose endpoints for uploading and retrieving invoices
- MongoDB to store extracted text and classification results
- Secure data handling (temporary storage, masking sensitive fields)
smart-invoice-classifier/
│
├── data/
│ ├── dummy_invoices/ # Generated sample invoices
│ └── labels.csv # Ground truth labels for training
│
├── src/
│ ├── extract/
│ │ └── pdf_extractor.py # OCR and text extraction scripts
│ ├── model/
│ │ └── classifier.py # Training and inference models
│ ├── api/
│ │ └── routes.py # Flask API endpoints
│ ├── utils/
│ │ └── __init__.py # Helper functions
│ └── database/
│ └── mongo_db.py # DB configuration and operations
│
├── tmp_uploads/ # Temporary storage for uploaded files
├── requirements.txt
├── README.md
└── main.py # Main application entry point
- Uses Tesseract OCR for text extraction from PDF invoices
- Handles various invoice formats and layouts
- Preprocesses images for better OCR accuracy
- NLP preprocessing (tokenization, TF-IDF, word embeddings)
- Multi-class classification (SVM, Random Forest, or Neural Networks)
- Model training and evaluation pipelines
- MongoDB integration for storing invoice data
- Secure storage of extracted text and classifications
- Efficient querying and retrieval operations

demo.video.mp4
- The project configuration (e.g., port number, MongoDB URL, etc.) is hardcoded instead of using an .env file to allow the recruiter to run the code directly without additional setup.

