This project implements the workflow shown in the architecture diagram for resume, invoice, and general document understanding.
- Accept text, PDF, or image input.
- Extract text with direct text reading, PDF extraction, or optional OCR.
- Detect or accept a language hint for English, Hindi, Bengali, Punjabi, and Malayalam.
- Classify the document as resume, invoice, or general.
- Mask private values such as email, phone, price, name, location, mobile number, and client location.
- Store the masked values in a privacy vault using a reversible local encoding key.
- Prepare English-processing text. English is passed through; Indic translation is a pluggable stage.
- Extract NER-style fields and related features.
- Create a short summary.
- Generate a lightweight embedding and update a local vector index.
- Dump the processed document to SQLite.
python main.py path\to\document.txtWith hints:
python main.py path\to\invoice.pdf --document-type invoice --language english
python main.py path\to\resume.txt --document-type resume --language bengaliOutputs are written to outputs/ by default:
document_understanding.sqlite3stores processed documents.vector_index.jsonstores embeddings for simple semantic search experiments.<document>_privacy_vault.jsonstores encrypted private values.<document>_result.jsonstores the full pipeline result.
PDF text extraction uses pdfplumber if the input is a PDF.
pip install pdfplumberImage OCR uses pytesseract and Pillow if the input is an image. Tesseract OCR must also be installed on the system.
pip install pytesseract PillowThe notebooks contain model-training experiments for LayoutLMv3 OCR/form understanding and XLM-R token classification. The runnable pipeline is intentionally lightweight so it works without downloading large models. --For running must write : python main.py file path
A premium React + TypeScript + Vanilla CSS web dashboard is available inside the frontend/ directory to manage and search your database records, upload files, and chat with an AI assistant.
The application is fully deployable with zero external dependencies. SQLite is used for the database (auto-initialized on startup).
.\run_app.ps1This launches both services in new windows:
- Backend API:
http://127.0.0.1:8000(FastAPI + Uvicorn) - Frontend Portal:
http://localhost:5173(React + Vite)
Backend:
cd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
uvicorn app.main:app --reloadFrontend (in another terminal):
cd frontend
pnpm install
pnpm run dev- 📊 Analytics Dashboard - Real-time metrics and system health
- 📤 CSV Manager - Upload and import CSV files directly
- 🔍 Record Explorer - Search and filter database records
- 🤖 AI Assistant - Chat with your documents using LangChain + OpenAI (optional)
- Python 3.8+
- Node.js 18+
- pnpm (or npm)
- No external database required (SQLite is embedded)
The application works out-of-the-box with default SQLite settings. For advanced configuration:
- Backend config: backend/app/config.py
- Frontend config: frontend/vite.config.ts
GET /health- Health checkPOST /csv/upload- Upload CSV filePOST /csv/import- Import local CSVGET /records- Search recordsPOST /chat- Chat with documentsGET /docs- Interactive API documentation (Swagger UI)
For more details, see the frontend/README.md.