InvoiceIQ
Invoice me
Description of your solution
Overview
The Invoice Processing System is a sophisticated AI-powered application that automates the extraction of structured data from invoices using multiple OCR engines and Large Language Models (LLMs). This system transforms unstructured PDF invoices into structured JSON data and provides an intuitive interface for querying extracted information using natural language.
Snapshots

Flow of Diagram
%%{init: {'theme': '', 'themeVariables': { 'primaryColor': '#1a1a1a', 'textColor': '#ffffff'}}}%%
flowchart TD
A[User Uploads PDF Invoice] --> B{File Validation}
B -->|Valid PDF| C[Store Temporarily]
B -->|Invalid| D[Show Error Message]
C --> E[Generate PDF Preview]
E --> F[Select OCR Engine]
F --> G[Extract Text with OCR]
G --> H{Text Quality Check}
H -->|Low Quality| I[Try Fallback OCR]
H -->|Good Quality| J[Normalize Text]
I --> H
J --> K[Select LLM Model]
K --> L[Construct LLM Prompt]
L --> M[Call LLM API]
M --> N[Validate JSON Response]
N --> O[Store Structured Data]
O --> P[Display Results UI]
P --> Q{User Query?}
Q -->|Yes| R[Process Natural Language Query]
Q -->|No| S[Wait for Interaction]
R --> T[Select Query LLM]
T --> U[Construct Query Context]
U --> V[Call LLM API]
V --> W[Format Response]
W --> X[Display Answer]
%% System Monitoring
subgraph Monitoring
Y[Performance Metrics]
Z[Health Checks]
AA[Error Logging]
end
G -->|Log| AA
M -->|Log| AA
V -->|Log| AA
C -->|Metrics| Y
M -->|Metrics| Y
V -->|Metrics| Y
Z -.->|API Status| M
Z -.->|API Status| V
%% Style Definitions
classDef userAction fill:#2563eb,stroke:#fff
classDef processing fill:#7c3aed,stroke:#fff
classDef decision fill:#059669,stroke:#fff
classDef error fill:#dc2626,stroke:#fff
classDef storage fill:#ea580c,stroke:#fff
classDef display fill:#f59e0b,stroke:#fff
classDef monitoring fill:#333333,stroke:#fff
class A,D userAction
class B,F,G,I,J,K,L,M,N,T,U,V,W decision
class C,E,O,P,Q,R,S,X processing
class H error
class Y,Z,AA monitoring
class X display
Key Features
Multi-Engine OCR Processing
- Auto Selection: Intelligently chooses the best OCR engine based on content
- Supported OCR Engines:
- PyMuPDF (fast text extraction)
- PDFPlumber (structured extraction)
- PDFMiner (text-focused extraction)
- Tesseract OCR (image-based extraction)
- Enhanced Tesseract (high-quality extraction)
AI-Powered Data Extraction
- Multiple LLM Support:
- Mistral Large (Latest)
- Llama 3.1 (70B)
- Llama 3.2 (90B)
- Llama 3.3 (70B)
- Llama Vision (11B)
- Grok 3 (314B)
- Grok 4 (405B)
- Cohere Command R+
Intelligent Query System
- Natural language processing for invoice queries
- Confidence-based responses
- Field-level extraction from questions
- Example queries for quick access
Performance Monitoring
- Real-time system metrics
- Processing time tracking
- Error rate monitoring
- Resource utilization statistics
Security Features
- Secure file handling
- Security headers (XSS protection, frame prevention)
- File size restrictions (16MB max)
- Environment variable configuration
User Interface Overview
Upload Section
- Drag-and-drop PDF upload area
- Model selection for OCR and LLM processing
- File information display
- Processing status indicators
Results Section
-
Document Preview
- First-page preview with zoom capability
- Base64-encoded image display
-
Extracted Data
- Syntax-highlighted JSON output
- Copy-to-clipboard functionality
- Processing method badges (OCR/LLM)
-
AI Responses
- Natural language answers to queries
- Confidence indicators (high/medium/low)
- Extracted fields display
- Response source model identification
Query Section
- Natural language question input
- LLM selection for query processing
- Example questions for quick access
- Processing status indicators
Workflow
-
Upload & Process:
- User uploads PDF invoice
- System selects OCR engine (user-selected or auto)
- Extracted text is sent to selected LLM
- Structured JSON data is generated
-
Results Display:
- Document preview shown
- Structured data displayed in JSON format
- Processing metrics shown
-
Natural Language Querying:
- User asks questions about the invoice
- System processes query with selected LLM
- Response displayed with confidence indicators
- Relevant fields extracted and shown
System Requirements
Backend Requirements
- Python 3.9+
- Flask
- PyMuPDF (fitz)
- pytesseract
- pdfminer.six
- pdfplumber
- Pillow (PIL)
- python-dotenv
- requests
- psutil
OCR Req
Tracks Applied (1)
Fintech: Bring your own problem in Fintech, leveraging Agentic AI.
Technologies used
Discussion
Builders also viewed
See more projects on Devfolio
