AI-Powered Multi-Modal Expense Tracking for India
Track expenses naturallyβjust speak, snap a receipt, or type. Fold understands Hinglish, extracts transaction details automatically, and maintains professional double-entry accounting. Built specifically for the Indian payment ecosystem.
[!WARNING]
The backend hosted on Hugging Face Spaces is currently down. As a result, AI extraction, database operations, and other backend functionalities are unavailable. You can, however, still explore the static frontend interface.
Fold is a production-grade, multi-modal financial extraction platform that simplifies personal expense management. This project showcases:
- Advanced AI/ML Pipeline: Integrates local Speech-to-Text (OpenAI Whisper), computer vision and text parsing (PaddleOCR + logo detection), and a custom-trained DistilBERT NLP classifier with 3 classification heads.
- Accounting Engine: Implements a professional double-entry ledger database schema ensuring transaction integrity, balance protection, and clean audit logs.
- Hinglish & UPI Ecosystem Specialization: Custom-trained to understand code-mixed Hinglish voice/text and resolve payment profiles (e.g. debiting HDFC Bank when GPay is mentioned).
- Production-Ready & Cloud-Native: Dockerized with a security-hardened, non-root runner user configuration and automated deploy workflow using GitHub Actions OIDC to Hugging Face Spaces.
Fold uses a sophisticated multi-stage pipeline to extract financial data from any input modality. The system is built for ultra-low latency with synchronous processingβno queues, no polling, just instant results.
Processing Flow:
- Input Layer: Text, voice notes, or images (receipts/UPI screenshots)
- Extraction Pipeline: Modality-specific processing (STT for audio, OCR for images)
- NLP Classification: Custom-trained DistilBERT model predicts category, payment method, and bank account
- Ledger System: Professional double-entry accounting with balance validation
- Response: Instant confirmation with transaction details
Fold isn't just an expense trackerβit's a complete financial management system with AI-powered intelligence.
Fold accepts expenses in any format you preferβno forms, no dropdowns, just natural input.
π€ Voice Input: Record voice notes in Hindi, English, or Hinglish. Fold uses OpenAI Whisper to transcribe and automatically extracts transaction details.
πΈ Image Input:
- UPI payment screenshots (GPay, PhonePe, Paytm, etc.)
- Physical receipts and bills
- Bank statements
Fold automatically detects payment provider logos, extracts amounts, merchants, and payment methods using computer vision + OCR.
Fold's custom-trained NLP model understands the Indian payment ecosystem and Hinglish naturally.
What Fold Extracts:
- β Amount: Handles βΉ symbol, Hindi number words (ΰ€Ήΰ€ΰ€Ύΰ€°, ΰ€²ΰ€Ύΰ€), currency formats
- β Category: 10 categories (food, travel, shopping, entertainment, healthcare, education, utilities, EMI, investment, friends)
- β Payment Method: UPI, card, cash
- β Payment Provider: GPay, PhonePe, Paytm, Slice, Jupiter, Fi, Niyo, CRED, etc.
- β Bank/Account: HDFC, ICICI, SBI, Axis, Kotak, and 15+ other Indian banks
- β Merchant/Description: What the expense was for
- β Cash Flow: Automatically detects expense vs income
The NLP Engine:
- Model: Fine-tuned DistilBERT with 3 classification heads
- Training Data: 42,500+ custom-generated examples
- Accuracy: ~94% category, ~98% payment method, ~91% bank account
- Languages: English, Hindi, Hinglish (code-mixed)
Fold automatically figures out which account to charge based on payment method.
Example:
- You say: "Paid via GPay"
- Fold knows: Your GPay is linked to HDFC Bank
- Result: HDFC Bank account is automatically debited
Account Types:
- π³ Bank Accounts: Savings/current with institution name and last 4 digits
- π° Cash Wallets: Physical cash tracking
- π¦ Credit Cards: Debt tracking (can have negative balances)
- π± UPI Apps: Linked to bank accounts (GPay β HDFC, PhonePe β Axis, etc.)
Supported Payment Providers: GPay, PhonePe, Paytm, BHIM, CRED, BharatPe, Amazon Pay, Slice, Jupiter, Fi, Niyo, Freecharge, Mobikwik
Fold implements real double-entry bookkeepingβthe same system used by accountants and businesses.
Every transaction creates balanced journal entries:
- Expense: Debit "Expense Account" β Credit "Funding Account" (bank/UPI/cash)
- Income: Debit "Destination Account" β Credit "Income Account"
- Investment: Debit "Investment Portfolio" β Credit "Funding Account"
- Transfer: Debit "To Account" β Credit "From Account"
Why This Matters:
- β Accuracy: Every rupee is accounted for (debits always equal credits)
- β Audit Trail: Complete history of where money came from and went to
- β Professional: Same system used by businesses and accountants
- β Integrity: Database constraints prevent data corruption
- β Reporting: Easy to generate balance sheets, income statements, cash flow reports
Balance Protection (3-Layer Guardrails):
- Database constraint prevents negative balances on cash/bank accounts
- Application layer validates balance before every transaction
- Frontend shows clear error messages
Balance Validation: Fold prevents overspending by validating account balances before processing transactions. If your bank balance is less than the expense amount, the transaction is rejected with a clear error message.
Get instant insights into your spending patterns with beautiful visualizations.
Weekly Reports:
- 7-day rolling window
- Total income, expenses, investments, net savings
- Top spending categories
- Breakdown by payment method
- Top 5 individual expenses
Monthly Reports:
- Current month-to-date
- Same metrics as weekly
- Longer-term trend analysis
Dashboard Visualizations:
- π Category pie charts
- π Daily spending trends
- πΉ Income vs expense comparison
- π³ Account balance cards
- π Top expenses list
- π Transaction history table
π€ Telegram Bot: Full-featured interface with inline keyboards and wizards.
Commands:
/expenseβ Quick expense posting/incomeβ Record income/investmentβ Track investments/transferβ Transfer between accounts/balanceβ Check account balances/weeklyβ 7-day spending report/monthlyβ Month-to-date report
Features:
- Voice note support (Hinglish/Hindi/English)
- Image upload for receipts
- Interactive category correction
- Inline dashboard with action buttons
- Onboarding wizard for account setup
π Web Dashboard: Modern Next.js interface with Clerk authentication.
Features:
- Real-time dashboard with charts and graphs
- Transaction history with filtering
- Account management (add banks, link UPI apps)
- Period toggle (weekly/monthly views)
- Responsive design for mobile/desktop
- Multi-modal input (text, audio, image upload)
π REST API: Full programmatic access for developers.
User Input: "450 rupay Swiggy GPay"
β
NLP Extraction (DistilBERT)
βββ Amount: βΉ450
βββ Category: food
βββ Payment Method: upi
βββ Payment Provider: gpay
βββ Bank: hdfc (from GPay profile)
β
Ledger Posting (Double-Entry)
βββ Debit: expense_operating βΉ450
βββ Credit: hdfc_bank βΉ450
β
Response: "Saved food expense of βΉ450. Paid from: HDFC Bank (via GPay). Journal #142."
User Input: Voice note "bees rupay ka chai piya"
β
Whisper STT (Speech-to-Text)
β Transcript: "bees rupay ka chai piya"
β
NLP Extraction (DistilBERT)
βββ Amount: βΉ20 (Hindi number word)
βββ Category: food
βββ Payment Method: cash
βββ Bank: cash_wallet
β
Ledger Posting
β
Response: "Recorded βΉ20.00 β chai. Category: food. Paid from: Cash Wallet."
User Input: UPI screenshot or receipt photo
β
Stage 1: UPI Logo Detection (Roboflow) ~500ms
βββ Detects: GPay logo β Provider: gpay
β
Stage 2: OCR Text Extraction (PaddleOCR) ~2-3s
βββ Extracts all text lines
βββ Spatial sorting
βββ Keyword scanning (Total, Amount, βΉ)
βββ Heuristic parsing (amount, payment method, last4)
β
Stage 3: LLM Structuring (Ollama, optional) ~1-2s
βββ Converts raw OCR to structured JSON
βββ Handles typos and OCR noise
βββ Extracts: amount, merchant, payment details
β
Stage 4: NLP Classification (DistilBERT) ~500ms
βββ Category prediction (10 classes)
βββ Payment method validation
βββ Bank account prediction
β
Stage 5: Result Merging <100ms
βββ Amount: Ollama β OCR β NLP (priority)
βββ Payment Provider: UPI detection β Ollama β OCR
βββ Category: NLP (most accurate)
βββ Bank: Ollama β NLP
β
Ledger Posting
β
Response: Full transaction details with extracted data
Why This Complex Pipeline?
- UPI screenshots: Clean, structured β Ollama excels
- Physical receipts: Noisy, varied layouts β OCR heuristics catch edge cases
- Robustness: Multiple extraction methods provide fallbacks
- Accuracy: Each stage specializes in what it does best
- Language: Python 3.11
- Framework: FastAPI (async web framework)
- Database: PostgreSQL (Supabase-hosted)
- Server: Uvicorn (ASGI server)
- NLP Model: DistilBERT (HuggingFace Transformers)
- Framework: PyTorch
- OCR: PaddleOCR 2.10
- STT: OpenAI Whisper (local "small" model)
- Computer Vision: Roboflow Inference API
- LLM: Ollama (local, llama3.2:3b model)
- Framework: Next.js 16 (React 19)
- Styling: Tailwind CSS 4
- Charts: Recharts
- Authentication: Clerk (OAuth, magic links)
- Language: TypeScript
- Containerization: Docker (custom production-optimized debian-slim image, non-root run user UID 1000)
- CI/CD Pipeline: GitHub Actions (OIDC-based automated deployment to Hugging Face Spaces)
- Bot Platform: Telegram Bot API
- Processing Model: Synchronous low-latency pipeline (no queues, no polling)
- Deployment Platform: Hugging Face Spaces (Docker SDK)
Track daily expenses, manage pocket money, stay within budget. No manual entryβjust snap a receipt or say "50 rupees chai."
Monitor household spending, bills, and personal finances. Consolidates all payment methods (bank, UPI, cash, credit cards) in one place.
Maintain detailed financial records, analyze spending patterns, export data for accounting. Professional-grade accounting without complex software.
Communicate naturally in mixed Hindi-English. No need to translateβspeak/type as you normally would.
- Multi-Modal Input: Text, voice, and images processed with equal intelligence
- Hinglish Support: Natural language understanding of code-mixed Hindi-English
- Indian Payment Ecosystem: Built specifically for UPI, Indian banks, and payment apps
- Smart Account Resolution: Automatically figures out which account to charge
- Professional Accounting: Double-entry ledger system with balance validation
- Privacy-Focused: All ML models run locally, no data sent to cloud AI services
- Zero Learning Curve: Natural language input, no forms or categories to remember
- Continuous Learning: Gets smarter from user corrections
- Real-Time Processing: Synchronous pipeline with instant feedback (<7s for images)
- Multi-Platform: Telegram bot + Web dashboard + REST API
Built to make expense tracking effortless for India.
Track naturally. Understand instantly. Stay in control.








