Discover. Compare. Secure. Your Perfect Home Loan
Born from my parents' struggle with home loan documents - an AI-powered platform built with React, TypeScript, and Python that uses NLP and document parsing to simplify complex policy comparisons for everyday people.
The AI Bank Policy Comparator empowers customers and analysts to:
- π€ Upload Documents: Ingest 2-4 bank home loan MITC documents (PDF/TXT/DOCX)
- π€ AI Analysis: Extract key terms using Google Gemini LLM with confidence scoring
- βοΈ Smart Comparison: Side-by-side analysis with human-readable explanations
- π Evidence Tracing: Click any cell to see normalized value, explanation, and source evidence
- π Export Results: Generate CSV/JSON reports for decision making
- π¨ Butter Money Branding: Beautiful blue gradient theme matching Butter Money's website
- Upload 2-4 home loan MITC documents from different banks
- Wait for AI processing (30-60 seconds per document)
- Compare policies side-by-side with clear explanations
- Click any cell to understand differences and see evidence
- Export comparison report for decision making
- Batch process multiple customer document sets
- Review confidence scores and flag low-confidence extractions
- Validate AI extractions against source documents
- Generate reports for customer consultations
bank-comparator/
βββ app/
β βββ models/ # Pydantic data models
β βββ services/ # Business logic
β β βββ document_service.py # Document processing
β β βββ extraction_service.py # AI fact extraction
β β βββ comparison_service.py # Policy comparison
β β βββ export_service.py # Report generation
β βββ api/ # FastAPI endpoints
β β βββ documents.py # Document upload/management
β β βββ comparison.py # Comparison endpoints
β β βββ main.py # API application
β βββ ui/ # Streamlit interface
β βββ main.py # Main UI application
β βββ beautiful_comparison.py # Comparison display
β βββ components.py # Reusable UI components
βββ tests/ # Test suite
βββ data/ # Sample documents and uploads
βββ logs/ # Application logs
βββ requirements.txt # Python dependencies
βββ run_api.py # API server launcher
βββ run_ui.py # UI server launcher
βββ README.md # This documentation
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Set up environment variables
cp .env.example .env
# Add your Google Gemini API key to .env# Terminal 1: Start FastAPI backend
python run_api.py
# Or: uvicorn app.api.main:app --reload --port 8000
# Terminal 2: Start Streamlit UI
python run_ui.py
# Or: streamlit run app/ui/main.py- Streamlit UI: http://localhost:8501
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
- Document Processing: PDF/TXT/DOCX upload and text extraction
- AI Integration: Google Gemini LLM for fact extraction with confidence scoring
- Smart Extraction: Rule-based + LLM hybrid approach for accuracy
- Comparison Engine: Side-by-side analysis with status indicators
- Beautiful UI: Butter Money branded interface with blue gradient theme
- Evidence Tracing: Click cells to see normalized values and source evidence
- Export Functionality: CSV/JSON report generation
- API Architecture: FastAPI backend with comprehensive endpoints
- Performance optimization for large documents
- Enhanced error handling and validation
- Comprehensive test coverage
- Docker containerization
- Batch processing for multiple document sets
- Advanced analytics and insights
- Integration with Butter Money's existing systems
- Mobile-responsive design improvements
- Auto-detects major Indian banks (HDFC, ICICI, SBI, Axis, Kotak)
- Clean bank names in comparison headers (no more confusing filenames)
- Contextual explanations for each policy term
- Indian financial notation support (βΉ, Rs, Lakhs, Crores)
- Hybrid extraction: Rule-based + Google Gemini LLM
- Confidence scoring with color-coded indicators
- Smart gap filling for missing information
- Conflict detection for contradictory data
- Expandable cells showing full values (no truncation)
- Human-readable explanations for each difference
- Evidence tracing with clean source text display
- Status indicators: Same/Different/Missing with clear badges
When you click any cell, see:
- Normalized value with clear formatting
- Brief explanation in plain English
- Confidence score with reliability indicator
- Exact evidence from source document
- Document reference for verification
- No truncated text - see complete information
- Clear bank identification - HDFC Bank vs ICICI Bank
- Intuitive navigation - click to explore
- Responsive layout for different screen sizes
- CSV reports for spreadsheet analysis
- JSON exports for system integration
- Comparison summaries with key metrics
- Evidence documentation for audit trails
- FastAPI - Modern Python web framework
- Google Gemini - LLM for document analysis
- PyMuPDF & PDFPlumber - PDF text extraction
- Pandas - Data processing and analysis
- Pydantic - Data validation and serialization
- Streamlit - Interactive web interface
- Plotly - Data visualization
- Custom CSS - Butter Money branding
- pytest - Testing framework
- uvicorn - ASGI server
- python-dotenv - Environment management
# Required
GOOGLE_API_KEY=your_gemini_api_key_here
# Optional
LOG_LEVEL=INFO
MAX_FILE_SIZE_MB=10
UPLOAD_DIR=./data/uploads- Port: 8000 (configurable)
- Max file size: 10MB per document
- Supported formats: PDF, TXT, DOCX
- Concurrent uploads: Up to 4 documents
1. "No module named 'app'" Error
# Make sure you're in the bank-comparator directory
cd bank-comparator
python run_api.py2. "Google API Key not found" Error
# Check your .env file has the correct API key
echo $GOOGLE_API_KEY # Should show your key3. "Port already in use" Error
# Kill existing processes
pkill -f "uvicorn"
pkill -f "streamlit"
# Or use different ports
uvicorn app.api.main:app --port 8001
streamlit run app/ui/main.py --server.port 85024. PDF Processing Issues
- Ensure PDFs are text-based (not scanned images)
- Check file size is under 10MB
- Try converting to TXT if extraction fails
5. Slow Processing
- Large documents take longer to process
- Check internet connection for Gemini API calls
- Monitor logs for processing status
- Smaller files process faster
- Text files are processed quicker than PDFs
- Clear document structure improves extraction accuracy
- Good internet connection reduces API latency
For issues or questions:
- Check the troubleshooting section above
- Review API logs in
logs/directory - Test with sample documents in
data/folder - Verify all dependencies are installed correctly
# Development mode with auto-reload
python run_api.py --reload
python run_ui.py --debug# Production mode
uvicorn app.api.main:app --host 0.0.0.0 --port 8000
streamlit run app/ui/main.py --server.port 8501 --server.address 0.0.0.0Helping customers discover, compare, and secure their perfect home loan