SpendWise is a simple Python Flask web application designed for users in Kenya to automatically categorize and summarize personal spending from bank or mobile money (M-Pesa) statements. It uses locally relevant keywords and services to provide accurate financial analysis.
🇰🇪 SpendWise: KSh Expense Categorizer
SpendWise is a simple Python Flask web application designed for users in Kenya to automatically categorize and summarize personal spending from bank or mobile money (M-Pesa) statements. It uses locally relevant keywords and services to provide accurate financial analysis.
✨ Features
Live Adaptive Learning (AI-Native): The system implements a live feedback loop. User corrections submitted via the "Correct" button are immediately stored and used to override existing categorization rules for subsequent analyses.
Localized Categories (KSh): Uses Kenyan-specific categories (e.g., MOBILE_MONEY, UTILITIES_BILLS, TRANSPORT_COMMUTE) and matches popular merchants and services (KPLC, Naivas, M-Pesa, Bolt, etc.). All transactions are formatted in Kenyan Shillings (KSh).
Model Adaptability (Ambiguity Handling): The system flags transactions that match multiple potential categories, prompting the user for clarification and generating high-value training data.
Security (CSRF Protection): Utilizes Flask's session management to implement Cross-Site Request Forgery (CSRF) protection on the input form.
Modern UI & Responsiveness: Built with Tailwind CSS for a modern, clean, and fully responsive interface.
🚀 Installation
Prerequisites
You need the following installed:
Python 3.x
Flask (The web framework)
Run this single command in your terminal inside your project directory to install the necessary dependency:
pip install flask
File Structure
Ensure your project folder contains the following structure:
your_project/
├── app.py
└── templates/
└── index.html
▶️ Usage
Activate Environment: Open your terminal (or VS Code integrated terminal) and activate your virtual environment (venv) if you have one:
.\venv\Scripts\activate
Start the App: Run the Python script:
python app.py
Access the Application: In your browser, go to the running address, usually:
127.0.0.1
Live AI Test Scenario
To demonstrate the adaptive …