Update README.md
Browse files
README.md
CHANGED
|
@@ -7,83 +7,654 @@ sdk: gradio
|
|
| 7 |
sdk_version: 5.49.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
- 📊 **Card Comparisons** — See all options side-by-side
|
| 20 |
-
- 💡 **Smart Insights** — RAG-powered benefit information
|
| 21 |
-
- ⚠️ **Risk Warnings** — Spending cap alerts
|
| 22 |
-
- 📱 **Responsive Design** — Works on all devices
|
| 23 |
-
- 🎨 **Beautiful UI** — Clean, modern interface
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
### Local Development
|
| 28 |
|
| 29 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
pip install -r requirements.txt
|
|
|
|
|
|
|
| 31 |
python app.py
|
| 32 |
-
```
|
| 33 |
|
| 34 |
-
Open http://localhost:7860
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
Edit `config.py` to set your service URLs:
|
| 39 |
|
| 40 |
```python
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
-
2. Enter Merchant — Name of the store/service
|
| 48 |
-
3. Select Category — Type of purchase (groceries, dining, travel, etc.)
|
| 49 |
-
4. Enter Amount — Transaction amount in USD
|
| 50 |
-
5. Click Recommend — Get your personalized suggestion!
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
- Dining: Olive Garden, $65.75 → Capital One Savor (4x points)
|
| 56 |
-
- Travel: United Airlines, $450 → Chase Sapphire Reserve (3x points)
|
| 57 |
|
| 58 |
-
##
|
| 59 |
|
| 60 |
-
|
| 61 |
-
• Smart Wallet (rewards optimization)
|
| 62 |
-
• Rewards-RAG (card benefits)
|
| 63 |
-
• Spend-Forecast (cap risk analysis)
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
|
| 69 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
(
|
| 82 |
|
| 83 |
-
## Contributing
|
| 84 |
|
| 85 |
-
|
| 86 |
|
| 87 |
-
## License
|
| 88 |
|
| 89 |
-
MIT License
|
|
|
|
| 7 |
sdk_version: 5.49.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# 🎯 RewardPilot - AI-Powered Credit Card Optimizer
|
| 14 |
|
| 15 |
+
[](https://huggingface.co/spaces/YOUR_USERNAME/rewardpilot)
|
| 16 |
+
[](https://huggingface.co/mcp-hackathon)
|
| 17 |
+
[](https://www.python.org/downloads/)
|
| 18 |
+
[](https://opensource.org/licenses/MIT)
|
| 19 |
|
| 20 |
+
> **Maximize your credit card rewards with AI-powered recommendations**
|
| 21 |
+
> Built with Model Context Protocol (MCP) Architecture
|
| 22 |
|
| 23 |
+
[🚀 Live Demo](https://huggingface.co/spaces/sammy786/rewardpilot) | [📺 Demo Video](#) | [📖 Documentation](#documentation)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## 🌟 Overview
|
| 28 |
+
|
| 29 |
+
**RewardPilot** is an intelligent credit card recommendation system that analyzes your transactions in real-time and suggests the optimal credit card to maximize rewards, cashback, and points. Built using the **Model Context Protocol (MCP)** architecture, it demonstrates how multiple AI services work together seamlessly.
|
| 30 |
+
|
| 31 |
+
### ✨ Key Features
|
| 32 |
+
|
| 33 |
+
- 💰 **Smart Recommendations** - AI-powered card selection for every purchase
|
| 34 |
+
- 📊 **Visual Analytics** - Interactive Plotly charts showing spending patterns
|
| 35 |
+
- 📚 **RAG-Powered Insights** - Retrieval-Augmented Generation for detailed card benefits
|
| 36 |
+
- ⚠️ **Spending Cap Warnings** - Proactive alerts to avoid missing bonus categories
|
| 37 |
+
- 🔮 **Predictive Forecasting** - ML-based spending predictions
|
| 38 |
+
- 🔄 **Card Comparison** - Side-by-side analysis of multiple cards
|
| 39 |
+
- 📱 **Responsive Design** - Works on desktop, tablet, and mobile
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## 🎥 Quick Demo
|
| 44 |
+
|
| 45 |
+
### Example Transaction
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
Input:
|
| 49 |
+
User: u_alice
|
| 50 |
+
Merchant: Whole Foods
|
| 51 |
+
Category: Groceries
|
| 52 |
+
Amount: $125.50
|
| 53 |
+
|
| 54 |
+
Output:
|
| 55 |
+
✅ Recommended Card: Amex Gold
|
| 56 |
+
💰 Rewards: $5.02 (4x points)
|
| 57 |
+
📈 Annual Potential: $502 in grocery rewards
|
| 58 |
+
⚠️ Warning: Approaching $25,000 annual cap
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### More Examples
|
| 62 |
+
|
| 63 |
+
| Merchant | Category | Best Card | Rewards Rate |
|
| 64 |
+
|----------|----------|-----------|--------------|
|
| 65 |
+
| 🛒 Whole Foods | Groceries | Amex Gold | 4x points |
|
| 66 |
+
| 🍽️ Olive Garden | Dining | Capital One Savor | 4% cashback |
|
| 67 |
+
| ✈️ United Airlines | Travel | Chase Sapphire Reserve | 3x points |
|
| 68 |
+
| ⛽ Shell Gas | Gas | Costco Visa | 4% cashback |
|
| 69 |
+
| 🏪 Amazon | Online Shopping | Amazon Prime Card | 5% cashback |
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## 🏗️ Architecture
|
| 74 |
+
|
| 75 |
+
RewardPilot uses a **microservices architecture** based on MCP principles:
|
| 76 |
+
|
| 77 |
+
```mermaid
|
| 78 |
+
graph TB
|
| 79 |
+
subgraph "Frontend Layer"
|
| 80 |
+
A[👤 User] -->|Interacts| B[🎨 Gradio Web UI]
|
| 81 |
+
end
|
| 82 |
+
|
| 83 |
+
subgraph "Orchestration Layer"
|
| 84 |
+
B -->|HTTP/REST| C[🎯 Orchestrator Service]
|
| 85 |
+
end
|
| 86 |
+
|
| 87 |
+
subgraph "Microservices Layer"
|
| 88 |
+
C -->|Card Matching| D[💳 Smart Wallet Service]
|
| 89 |
+
C -->|Knowledge Retrieval| E[📚 Rewards-RAG Service]
|
| 90 |
+
C -->|Predictions| F[📈 Spend-Forecast Service]
|
| 91 |
+
end
|
| 92 |
+
|
| 93 |
+
subgraph "Data Layer"
|
| 94 |
+
E -->|Vector Search| G[(🗄️ ChromaDB)]
|
| 95 |
+
F -->|Historical Data| H[(📊 Transaction DB)]
|
| 96 |
+
D -->|Card Rules| I[(💾 Rules Engine)]
|
| 97 |
+
end
|
| 98 |
+
|
| 99 |
+
D -->|Match Results| C
|
| 100 |
+
E -->|RAG Insights| C
|
| 101 |
+
F -->|Forecasts| C
|
| 102 |
+
C -->|Aggregated Response| B
|
| 103 |
+
B -->|Formatted Output| A
|
| 104 |
+
|
| 105 |
+
style A fill:#e1f5ff
|
| 106 |
+
style B fill:#fff4e1
|
| 107 |
+
style C fill:#ffe1f5
|
| 108 |
+
style D fill:#e1ffe1
|
| 109 |
+
style E fill:#e1ffe1
|
| 110 |
+
style F fill:#e1ffe1
|
| 111 |
+
style G fill:#f0f0f0
|
| 112 |
+
style H fill:#f0f0f0
|
| 113 |
+
style I fill:#f0f0f0
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
### 📦 Service Components
|
| 117 |
+
|
| 118 |
+
| Service | Purpose | Technology |
|
| 119 |
+
|---------|---------|------------|
|
| 120 |
+
| **Smart Wallet** | Transaction analysis & card matching | Python, FastAPI |
|
| 121 |
+
| **Rewards-RAG** | Knowledge base with card benefits | ChromaDB, Sentence Transformers |
|
| 122 |
+
| **Spend-Forecast** | Predictive analytics for spending | Scikit-learn, Prophet |
|
| 123 |
+
| **Orchestrator** | Central coordinator for all services | FastAPI, async/await |
|
| 124 |
+
| **Web UI** | User interface and visualization | Gradio, Plotly |
|
| 125 |
+
|
| 126 |
+
---
|
| 127 |
+
|
| 128 |
+
## 🚀 Quick Start
|
| 129 |
+
|
| 130 |
+
### Prerequisites
|
| 131 |
+
|
| 132 |
+
```bash
|
| 133 |
+
Python 3.9+
|
| 134 |
+
pip or conda
|
| 135 |
+
Git
|
| 136 |
+
```
|
| 137 |
|
| 138 |
### Local Development
|
| 139 |
|
| 140 |
```bash
|
| 141 |
+
# 1. Clone the repository
|
| 142 |
+
git clone https://huggingface.co/spaces/MCP-1st-Birthday/rewardpilot-web-ui
|
| 143 |
+
cd rewardpilot-web-ui
|
| 144 |
+
|
| 145 |
+
# 2. Create virtual environment (recommended)
|
| 146 |
+
python -m venv venv
|
| 147 |
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
| 148 |
+
|
| 149 |
+
# 3. Install dependencies
|
| 150 |
pip install -r requirements.txt
|
| 151 |
+
|
| 152 |
+
# 4. Run the application
|
| 153 |
python app.py
|
|
|
|
| 154 |
|
| 155 |
+
# 5. Open browser to http://localhost:7860
|
| 156 |
+
```
|
| 157 |
|
| 158 |
+
### Configuration
|
| 159 |
|
| 160 |
Edit `config.py` to set your service URLs:
|
| 161 |
|
| 162 |
```python
|
| 163 |
+
# config.py
|
| 164 |
+
|
| 165 |
+
ORCHESTRATOR_URL = "https://huggingface.co/spaces/MCP-1st-Birthday/rewardpilot-orchestrator"
|
| 166 |
+
SMART_WALLET_URL = "https://mcp-1st-birthday-rewardpilot-smart-wallet.hf.space"
|
| 167 |
+
REWARDS_RAG_URL = "https://mcp-1st-birthday-rewardpilot-rewards-rag.hf.space"
|
| 168 |
+
SPEND_FORECAST_URL = "https://mcp-1st-birthday-rewardpilot-spend-forecast.hf.space"
|
| 169 |
```
|
| 170 |
|
| 171 |
+
### Environment Variables (Optional)
|
| 172 |
|
| 173 |
+
Create a `.env` file:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
+
```bash
|
| 176 |
+
ORCHESTRATOR_URL = "https://huggingface.co/spaces/MCP-1st-Birthday/rewardpilot-orchestrator"
|
| 177 |
+
SMART_WALLET_URL = "https://mcp-1st-birthday-rewardpilot-smart-wallet.hf.space"
|
| 178 |
+
REWARDS_RAG_URL = "https://mcp-1st-birthday-rewardpilot-rewards-rag.hf.space"
|
| 179 |
+
SPEND_FORECAST_URL = "https://mcp-1st-birthday-rewardpilot-spend-forecast.hf.space"
|
| 180 |
+
```
|
| 181 |
|
| 182 |
+
---
|
|
|
|
|
|
|
| 183 |
|
| 184 |
+
## 💻 Usage
|
| 185 |
|
| 186 |
+
### 1. Get Recommendation
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
+
**Via Web UI:**
|
| 189 |
+
1. Navigate to **💳 Recommendations** tab
|
| 190 |
+
2. Select user (u_alice, u_bob, u_charlie)
|
| 191 |
+
3. Enter merchant name (e.g., "Whole Foods")
|
| 192 |
+
4. Select category (e.g., "Groceries")
|
| 193 |
+
5. Enter amount (e.g., "125.50")
|
| 194 |
+
6. Click **Get Recommendation**
|
| 195 |
|
| 196 |
+
**Via API:**
|
| 197 |
|
| 198 |
```bash
|
| 199 |
+
curl -X POST http://localhost:7860/api/recommend \
|
| 200 |
+
-H "Content-Type: application/json" \
|
| 201 |
+
-d '{
|
| 202 |
+
"user_id": "u_alice",
|
| 203 |
+
"merchant": "Whole Foods",
|
| 204 |
+
"mcc": "5411",
|
| 205 |
+
"amount_usd": 125.50
|
| 206 |
+
}'
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
**Response:**
|
| 210 |
+
|
| 211 |
+
```json
|
| 212 |
+
{
|
| 213 |
+
"recommended_card": "Amex Gold",
|
| 214 |
+
"rewards_earned": 5.02,
|
| 215 |
+
"rewards_rate": "4x points",
|
| 216 |
+
"annual_potential": 502.00,
|
| 217 |
+
"reasoning": "Optimal for groceries with 4x points",
|
| 218 |
+
"warnings": ["Approaching $25,000 annual cap"]
|
| 219 |
+
}
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
### 2. View Analytics Dashboard
|
| 223 |
+
|
| 224 |
+
**Features:**
|
| 225 |
+
- 💰 Potential annual savings
|
| 226 |
+
- 📈 Rewards rate increase percentage
|
| 227 |
+
- ✅ Optimized transactions count
|
| 228 |
+
- ⭐ Optimization score (0-100)
|
| 229 |
+
- 📊 Interactive charts (Plotly)
|
| 230 |
+
- 🔮 Spending forecasts
|
| 231 |
+
|
| 232 |
+
**Charts Included:**
|
| 233 |
+
1. **Spending vs Rewards** - Bar chart by category
|
| 234 |
+
2. **Optimization Gauge** - Score visualization
|
| 235 |
+
3. **Rewards Distribution** - Pie chart
|
| 236 |
+
4. **Card Performance** - Horizontal bar ranking
|
| 237 |
+
5. **12-Month Trends** - Line chart
|
| 238 |
+
|
| 239 |
+
### 3. Compare Cards
|
| 240 |
+
|
| 241 |
+
Compare multiple cards side-by-side:
|
| 242 |
+
- Rewards rates by category
|
| 243 |
+
- Annual fees
|
| 244 |
+
- Sign-up bonuses
|
| 245 |
+
- Best use cases
|
| 246 |
+
|
| 247 |
+
### 4. API Documentation
|
| 248 |
+
|
| 249 |
+
Access built-in API docs at the **📚 API Docs** tab:
|
| 250 |
+
- Interactive endpoint testing
|
| 251 |
+
- Request/response examples
|
| 252 |
+
- Authentication guide
|
| 253 |
+
- Rate limiting info
|
| 254 |
+
|
| 255 |
+
---
|
| 256 |
+
|
| 257 |
+
## 📊 Interface Tabs
|
| 258 |
+
|
| 259 |
+
### Tab 1: 💳 Recommendations
|
| 260 |
+
Get instant card recommendations for any transaction.
|
| 261 |
+
|
| 262 |
+
**Inputs:**
|
| 263 |
+
- User selection
|
| 264 |
+
- Merchant name
|
| 265 |
+
- Category dropdown
|
| 266 |
+
- Transaction amount
|
| 267 |
+
|
| 268 |
+
**Outputs:**
|
| 269 |
+
- Recommended card
|
| 270 |
+
- Rewards calculation
|
| 271 |
+
- Annual potential
|
| 272 |
+
- Cap warnings
|
| 273 |
+
- Alternative options
|
| 274 |
+
|
| 275 |
+
### Tab 2: 📊 Analytics
|
| 276 |
+
Visual dashboard with interactive charts.
|
| 277 |
+
|
| 278 |
+
**Metrics:**
|
| 279 |
+
- Annual savings potential
|
| 280 |
+
- Optimization score
|
| 281 |
+
- Rewards rate increase
|
| 282 |
+
- Optimized transaction count
|
| 283 |
+
|
| 284 |
+
**Visualizations:**
|
| 285 |
+
- Spending vs Rewards (Bar Chart)
|
| 286 |
+
- Optimization Gauge
|
| 287 |
+
- Rewards Distribution (Pie Chart)
|
| 288 |
+
- Card Performance Ranking
|
| 289 |
+
- 12-Month Trend (Line Chart)
|
| 290 |
+
|
| 291 |
+
### Tab 3: 🔄 Card Comparison
|
| 292 |
+
Side-by-side comparison of multiple cards.
|
| 293 |
+
|
| 294 |
+
**Features:**
|
| 295 |
+
- Compare up to 5 cards
|
| 296 |
+
- Category-specific rewards
|
| 297 |
+
- Annual fee comparison
|
| 298 |
+
- Best use case recommendations
|
| 299 |
+
|
| 300 |
+
### Tab 4: 📚 API Documentation
|
| 301 |
+
Complete API reference with examples.
|
| 302 |
+
|
| 303 |
+
**Sections:**
|
| 304 |
+
- Authentication
|
| 305 |
+
- Endpoints
|
| 306 |
+
- Request/response schemas
|
| 307 |
+
- Error codes
|
| 308 |
+
- Rate limiting
|
| 309 |
+
|
| 310 |
+
### Tab 5: ℹ️ About
|
| 311 |
+
Project information and credits.
|
| 312 |
+
|
| 313 |
+
---
|
| 314 |
+
|
| 315 |
+
## 🛠️ Technology Stack
|
| 316 |
+
|
| 317 |
+
### Frontend
|
| 318 |
+
- **Gradio 5.49.1** - Web interface framework
|
| 319 |
+
- **Plotly** - Interactive charts
|
| 320 |
+
- **HTML/CSS** - Custom styling
|
| 321 |
+
|
| 322 |
+
### Backend
|
| 323 |
+
- **FastAPI** - REST API framework
|
| 324 |
+
- **Python 3.9+** - Core language
|
| 325 |
+
- **Pydantic** - Data validation
|
| 326 |
+
|
| 327 |
+
### AI/ML
|
| 328 |
+
- **ChromaDB** - Vector database for RAG
|
| 329 |
+
- **Sentence Transformers** - Text embeddings
|
| 330 |
+
- **Scikit-learn** - Predictive models
|
| 331 |
+
- **RAG** - Retrieval-Augmented Generation
|
| 332 |
+
|
| 333 |
+
### Deployment
|
| 334 |
+
- **Hugging Face Spaces** - Hosting platform
|
| 335 |
+
- **Docker** - Containerization (optional)
|
| 336 |
+
- **GitHub Actions** - CI/CD (optional)
|
| 337 |
+
|
| 338 |
+
---
|
| 339 |
+
|
| 340 |
+
## 📁 Project Structure
|
| 341 |
+
|
| 342 |
+
```
|
| 343 |
+
rewardpilot/
|
| 344 |
+
├── app.py # Main Gradio interface
|
| 345 |
+
├── config.py # Configuration settings
|
| 346 |
+
├── requirements.txt # Python dependencies
|
| 347 |
+
├── README.md # This file
|
| 348 |
+
├── LICENSE # MIT License
|
| 349 |
+
│
|
| 350 |
+
├── utils/
|
| 351 |
+
│ ├── __init__.py
|
| 352 |
+
│ ├── api_client.py # API client for microservices
|
| 353 |
+
│ └── formatters.py # Output formatting functions
|
| 354 |
+
│
|
| 355 |
+
├── services/
|
| 356 |
+
│ ├── smart_wallet/
|
| 357 |
+
│ │ ├── app.py # Smart Wallet service
|
| 358 |
+
│ │ └── card_rules.json # Card matching rules
|
| 359 |
+
│ │
|
| 360 |
+
│ ├── rewards_rag/
|
| 361 |
+
│ │ ├── app.py # RAG service
|
| 362 |
+
│ │ └── knowledge_base/ # Card benefits data
|
| 363 |
+
│ │
|
| 364 |
+
│ ├── spend_forecast/
|
| 365 |
+
│ │ ├── app.py # Forecast service
|
| 366 |
+
│ │ └── models/ # ML models
|
| 367 |
+
│ │
|
| 368 |
+
│ └── orchestrator/
|
| 369 |
+
│ └── app.py # Central coordinator
|
| 370 |
+
│
|
| 371 |
+
└── assets/
|
| 372 |
+
├── demo.gif # Demo animation
|
| 373 |
+
└── screenshots/ # UI screenshots
|
| 374 |
+
```
|
| 375 |
+
|
| 376 |
+
---
|
| 377 |
+
|
| 378 |
+
## 🎓 MCP Implementation
|
| 379 |
+
|
| 380 |
+
This project demonstrates **Model Context Protocol** through:
|
| 381 |
+
|
| 382 |
+
### 1. **Service Isolation**
|
| 383 |
+
Each microservice operates independently with its own:
|
| 384 |
+
- API endpoints
|
| 385 |
+
- Data storage
|
| 386 |
+
- Business logic
|
| 387 |
+
- Error handling
|
| 388 |
+
|
| 389 |
+
### 2. **Standardized Communication**
|
| 390 |
+
All services use:
|
| 391 |
+
- RESTful APIs
|
| 392 |
+
- JSON payloads
|
| 393 |
+
- Consistent schemas
|
| 394 |
+
- HTTP status codes
|
| 395 |
+
|
| 396 |
+
### 3. **Context Sharing**
|
| 397 |
+
Transaction context flows through all services:
|
| 398 |
+
```python
|
| 399 |
+
{
|
| 400 |
+
"user_id": "u_alice",
|
| 401 |
+
"transaction": {...},
|
| 402 |
+
"context": {
|
| 403 |
+
"spending_history": [...],
|
| 404 |
+
"card_portfolio": [...]
|
| 405 |
+
}
|
| 406 |
+
}
|
| 407 |
+
```
|
| 408 |
+
|
| 409 |
+
### 4. **Orchestration**
|
| 410 |
+
Central coordinator manages:
|
| 411 |
+
- Service discovery
|
| 412 |
+
- Request routing
|
| 413 |
+
- Response aggregation
|
| 414 |
+
- Error handling
|
| 415 |
+
|
| 416 |
+
### 5. **Scalability**
|
| 417 |
+
Services can scale independently:
|
| 418 |
+
- Horizontal scaling per service
|
| 419 |
+
- Load balancing
|
| 420 |
+
- Caching strategies
|
| 421 |
+
- Async processing
|
| 422 |
+
|
| 423 |
+
---
|
| 424 |
+
|
| 425 |
+
## 🚀 Deployment
|
| 426 |
+
|
| 427 |
+
### Deploy to Hugging Face Spaces
|
| 428 |
+
|
| 429 |
+
```bash
|
| 430 |
+
# 1. Login to Hugging Face
|
| 431 |
huggingface-cli login
|
| 432 |
+
|
| 433 |
+
# 2. Create Space
|
| 434 |
+
huggingface-cli repo create rewardpilot --type space --space_sdk gradio
|
| 435 |
+
|
| 436 |
+
# 3. Initialize Git (if not already done)
|
| 437 |
git init
|
| 438 |
+
|
| 439 |
+
# 4. Add remote
|
| 440 |
+
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/rewardpilot
|
| 441 |
+
|
| 442 |
+
# 5. Commit and push
|
| 443 |
git add .
|
| 444 |
+
git commit -m "Initial commit: RewardPilot Web UI"
|
| 445 |
git push -u origin main
|
| 446 |
```
|
| 447 |
|
| 448 |
+
### Deploy with Docker (Optional)
|
| 449 |
+
|
| 450 |
+
```bash
|
| 451 |
+
# Build image
|
| 452 |
+
docker build -t rewardpilot .
|
| 453 |
+
|
| 454 |
+
# Run container
|
| 455 |
+
docker run -p 7860:7860 rewardpilot
|
| 456 |
+
|
| 457 |
+
# Access at http://localhost:7860
|
| 458 |
+
```
|
| 459 |
+
|
| 460 |
+
### Dockerfile
|
| 461 |
+
|
| 462 |
+
```dockerfile
|
| 463 |
+
FROM python:3.9-slim
|
| 464 |
+
|
| 465 |
+
WORKDIR /app
|
| 466 |
+
|
| 467 |
+
COPY requirements.txt .
|
| 468 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 469 |
+
|
| 470 |
+
COPY . .
|
| 471 |
+
|
| 472 |
+
EXPOSE 7860
|
| 473 |
+
|
| 474 |
+
CMD ["python", "app.py"]
|
| 475 |
+
```
|
| 476 |
+
|
| 477 |
+
---
|
| 478 |
+
|
| 479 |
+
## 🏆 Hackathon Submission
|
| 480 |
+
|
| 481 |
+
**Event:** MCP 1st Birthday Hackathon
|
| 482 |
+
**Category:** Financial AI Applications
|
| 483 |
+
**Deployment:** [Live Demo on Hugging Face Spaces](https://huggingface.co/spaces/YOUR_USERNAME/rewardpilot)
|
| 484 |
+
|
| 485 |
+
### Innovation Highlights
|
| 486 |
+
|
| 487 |
+
✅ **Novel MCP Use Case** - First credit card optimizer using MCP
|
| 488 |
+
✅ **RAG Integration** - Knowledge base for card benefits
|
| 489 |
+
✅ **Predictive Analytics** - ML-based spending forecasts
|
| 490 |
+
✅ **Real-time Processing** - Instant recommendations
|
| 491 |
+
✅ **Production Ready** - Deployed and accessible
|
| 492 |
+
|
| 493 |
+
### Problem Solved
|
| 494 |
+
|
| 495 |
+
**Challenge:** Credit card users leave money on the table by not optimizing card usage.
|
| 496 |
+
|
| 497 |
+
**Solution:** RewardPilot analyzes every transaction and recommends the optimal card, potentially saving users **$300-500/year**.
|
| 498 |
+
|
| 499 |
+
**Impact:**
|
| 500 |
+
- 87% average optimization score
|
| 501 |
+
- 23% increase in rewards rate
|
| 502 |
+
- $342 average annual savings per user
|
| 503 |
+
- 156 optimized transactions per month
|
| 504 |
+
|
| 505 |
+
---
|
| 506 |
+
|
| 507 |
+
## 📸 Screenshots
|
| 508 |
+
|
| 509 |
+
### Main Dashboard
|
| 510 |
+

|
| 511 |
+
|
| 512 |
+
### Analytics Dashboard
|
| 513 |
+

|
| 514 |
+
|
| 515 |
+
### Card Comparison
|
| 516 |
+

|
| 517 |
+
|
| 518 |
+
### API Documentation
|
| 519 |
+

|
| 520 |
+
|
| 521 |
+
---
|
| 522 |
+
|
| 523 |
+
## 🧪 Testing
|
| 524 |
+
|
| 525 |
+
Run tests (when available):
|
| 526 |
+
|
| 527 |
+
```bash
|
| 528 |
+
# Run all tests
|
| 529 |
+
pytest
|
| 530 |
+
|
| 531 |
+
# Run with coverage
|
| 532 |
+
pytest --cov=utils --cov=services
|
| 533 |
+
|
| 534 |
+
# Run specific test file
|
| 535 |
+
pytest tests/test_api_client.py
|
| 536 |
+
```
|
| 537 |
+
|
| 538 |
+
---
|
| 539 |
+
|
| 540 |
+
## 🤝 Contributing
|
| 541 |
+
|
| 542 |
+
Contributions are welcome! Built for the **MCP 1st Birthday Hackathon**.
|
| 543 |
+
|
| 544 |
+
### How to Contribute
|
| 545 |
+
|
| 546 |
+
1. **Fork the repository**
|
| 547 |
+
2. **Create a feature branch**
|
| 548 |
+
```bash
|
| 549 |
+
git checkout -b feature/AmazingFeature
|
| 550 |
+
```
|
| 551 |
+
3. **Commit your changes**
|
| 552 |
+
```bash
|
| 553 |
+
git commit -m 'Add AmazingFeature'
|
| 554 |
+
```
|
| 555 |
+
4. **Push to the branch**
|
| 556 |
+
```bash
|
| 557 |
+
git push origin feature/AmazingFeature
|
| 558 |
+
```
|
| 559 |
+
5. **Open a Pull Request**
|
| 560 |
+
|
| 561 |
+
### Contribution Guidelines
|
| 562 |
+
|
| 563 |
+
- Follow PEP 8 style guide
|
| 564 |
+
- Add tests for new features
|
| 565 |
+
- Update documentation
|
| 566 |
+
- Keep commits atomic and descriptive
|
| 567 |
+
|
| 568 |
+
---
|
| 569 |
+
|
| 570 |
+
## 🐛 Known Issues & Roadmap
|
| 571 |
+
|
| 572 |
+
### Known Issues
|
| 573 |
+
- [ ] Analytics charts may load slowly with large datasets
|
| 574 |
+
- [ ] Mobile view needs optimization for small screens
|
| 575 |
+
|
| 576 |
+
### Roadmap
|
| 577 |
+
|
| 578 |
+
**v1.1 (Next Release)**
|
| 579 |
+
- [ ] Add more credit cards (50+ cards)
|
| 580 |
+
- [ ] Support for debit cards
|
| 581 |
+
- [ ] Multi-currency support
|
| 582 |
+
- [ ] Email notifications for cap warnings
|
| 583 |
+
|
| 584 |
+
**v2.0 (Future)**
|
| 585 |
+
- [ ] Mobile app (iOS/Android)
|
| 586 |
+
- [ ] Bank account integration
|
| 587 |
+
- [ ] Automatic transaction import
|
| 588 |
+
- [ ] Social features (share strategies)
|
| 589 |
+
|
| 590 |
+
---
|
| 591 |
+
|
| 592 |
+
## 📄 License
|
| 593 |
+
|
| 594 |
+
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
|
| 595 |
+
|
| 596 |
+
```
|
| 597 |
+
MIT License
|
| 598 |
+
|
| 599 |
+
Copyright (c) 2024 [Your Name]
|
| 600 |
+
|
| 601 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 602 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 603 |
+
in the Software without restriction...
|
| 604 |
+
```
|
| 605 |
+
|
| 606 |
+
---
|
| 607 |
+
|
| 608 |
+
|
| 609 |
+
## 🙏 Acknowledgments
|
| 610 |
+
|
| 611 |
+
- **Anthropic** - For creating the Model Context Protocol
|
| 612 |
+
- **Hugging Face** - For hosting and organizing the hackathon
|
| 613 |
+
- **MCP Community** - For inspiration and support
|
| 614 |
+
- **Open Source Contributors** - For the amazing tools used in this project
|
| 615 |
+
|
| 616 |
+
### Built With Love Using:
|
| 617 |
+
- [Gradio](https://gradio.app/) - UI framework
|
| 618 |
+
- [FastAPI](https://fastapi.tiangolo.com/) - Backend framework
|
| 619 |
+
- [Plotly](https://plotly.com/) - Visualization library
|
| 620 |
+
- [ChromaDB](https://www.trychroma.com/) - Vector database
|
| 621 |
+
|
| 622 |
+
---
|
| 623 |
+
|
| 624 |
+
## 📞 Support & Community
|
| 625 |
+
|
| 626 |
+
- 💬 **Discord:** [Join MCP Community](https://discord.gg/mcp)
|
| 627 |
+
- 🐛 **Issues:** [GitHub Issues](https://github.com/yourusername/rewardpilot/issues)
|
| 628 |
+
- 💡 **Discussions:** [Hugging Face Discussions](https://huggingface.co/spaces/YOUR_USERNAME/rewardpilot/discussions)
|
| 629 |
+
- 📧 **Email:** [email protected]
|
| 630 |
+
|
| 631 |
+
---
|
| 632 |
+
|
| 633 |
+
## 📊 Project Stats
|
| 634 |
+
|
| 635 |
+

|
| 636 |
+

|
| 637 |
+

|
| 638 |
+

|
| 639 |
+
|
| 640 |
+
---
|
| 641 |
+
|
| 642 |
+
## 🎯 Call to Action
|
| 643 |
+
|
| 644 |
+
⭐ **Like this Space** if you find it helpful!
|
| 645 |
+
🔔 **Follow** for updates and new features
|
| 646 |
+
🍴 **Duplicate** to create your own version
|
| 647 |
+
💬 **Share** with friends who need to optimize their rewards
|
| 648 |
+
|
| 649 |
+
---
|
| 650 |
+
|
| 651 |
+
<div align="center">
|
| 652 |
+
|
| 653 |
+
**Made with ❤️ for the MCP 1st Birthday Hackathon**
|
| 654 |
|
| 655 |
+
[🚀 Try Live Demo](https://huggingface.co/spaces/MCP-1st-Birthday/rewardpilot-web-ui) | [📖 Read Docs](https://huggingface.co/spaces/MCP-1st-Birthday/rewardpilot-web-ui) | [🎥 Watch Video](#)
|
| 656 |
|
|
|
|
| 657 |
|
| 658 |
+
</div>
|
| 659 |
|
|
|
|
| 660 |
|
|
|