sammy786 commited on
Commit
e700743
ยท
verified ยท
1 Parent(s): e30fef4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +207 -33
app.py CHANGED
@@ -36,17 +36,17 @@ def get_recommendation(
36
  None,
37
  None,
38
  )
39
-
40
  # Determine MCC code
41
  if use_custom_mcc and custom_mcc:
42
  mcc = custom_mcc
43
  else:
44
  mcc = MCC_CATEGORIES.get(category, "5999")
45
-
46
  # Set default date if not provided
47
  if not transaction_date:
48
  transaction_date = str(date.today())
49
-
50
  # Call API
51
  response: Dict[str, Any] = client.get_recommendation_sync(
52
  user_id=user_id,
@@ -55,10 +55,10 @@ def get_recommendation(
55
  amount_usd=amount,
56
  transaction_date=transaction_date,
57
  )
58
-
59
  # Format response
60
  formatted_text = format_full_recommendation(response)
61
-
62
  # Extract card details for comparison
63
  comparison_table: Optional[str]
64
  stats: Optional[str]
@@ -67,7 +67,7 @@ def get_recommendation(
67
  alternatives: List[Dict[str, Any]] = response.get("alternative_cards", []) or []
68
  all_cards = [c for c in ([recommended] + alternatives) if c]
69
  comparison_table = format_comparison_table(all_cards) if all_cards else None
70
-
71
  # Create summary stats
72
  total_analyzed = response.get("total_cards_analyzed", len(all_cards))
73
  best_reward = (recommended.get("reward_amount") or 0.0)
@@ -80,7 +80,7 @@ def get_recommendation(
80
  else:
81
  comparison_table = None
82
  stats = None
83
-
84
  return formatted_text, comparison_table, stats
85
 
86
  # ===================== Sample Transaction Examples =====================
@@ -107,6 +107,69 @@ with gr.Blocks(
107
  font-size: 16px;
108
  line-height: 1.6;
109
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  """,
111
  ) as app:
112
  # Header
@@ -114,30 +177,30 @@ with gr.Blocks(
114
  f"""
115
  # {APP_TITLE}
116
  {APP_DESCRIPTION}
 
117
  Get AI-powered credit card recommendations that maximize your rewards based on:
118
  - ๐Ÿ’ฐ **Reward Rates** - Optimal card selection for each purchase
119
  - ๐Ÿ“š **Card Benefits** - Detailed information from our knowledge base
120
  - โš ๏ธ **Spending Caps** - Risk warnings to avoid missing out on bonuses
 
121
  ---
122
  """
123
  )
124
-
125
- # Ensure all three tabs are siblings at the same level
126
  with gr.Tabs():
127
-
128
  # ========== Tab 1: Get Recommendation ==========
129
  with gr.Tab("๐ŸŽฏ Get Recommendation"):
130
  with gr.Row():
131
  with gr.Column(scale=1):
132
  gr.Markdown("### Transaction Details")
133
-
134
  user_dropdown = gr.Dropdown(
135
  choices=SAMPLE_USERS,
136
  value=SAMPLE_USERS[0],
137
  label="User ID",
138
  info="Select a user"
139
  )
140
-
141
  # CATEGORY FIRST (moved up)
142
  category_dropdown = gr.Dropdown(
143
  choices=list(MCC_CATEGORIES.keys()),
@@ -145,7 +208,7 @@ Get AI-powered credit card recommendations that maximize your rewards based on:
145
  label="๐Ÿท๏ธ Type of Purchase",
146
  info="Select the category first"
147
  )
148
-
149
  # MERCHANT DROPDOWN (now dynamic)
150
  merchant_dropdown = gr.Dropdown(
151
  choices=MERCHANTS_BY_CATEGORY["Groceries"],
@@ -154,20 +217,20 @@ Get AI-powered credit card recommendations that maximize your rewards based on:
154
  info="Select merchant (changes based on category)",
155
  allow_custom_value=True # Allows typing custom merchants
156
  )
157
-
158
  amount_input = gr.Number(
159
  label="๐Ÿ’ต Amount (USD)",
160
  value=125.50,
161
  minimum=0.01,
162
  step=0.01
163
  )
164
-
165
  date_input = gr.Textbox(
166
  label="๐Ÿ“… Transaction Date (Optional)",
167
  placeholder="YYYY-MM-DD or leave blank for today",
168
  value=""
169
  )
170
-
171
  # Advanced options
172
  with gr.Accordion("โš™๏ธ Advanced Options", open=False):
173
  use_custom_mcc = gr.Checkbox(
@@ -179,30 +242,29 @@ Get AI-powered credit card recommendations that maximize your rewards based on:
179
  placeholder="e.g., 5411",
180
  visible=False
181
  )
182
-
183
  def toggle_custom_mcc(use_custom):
184
  return gr.update(visible=use_custom)
185
-
186
  use_custom_mcc.change(
187
  fn=toggle_custom_mcc,
188
  inputs=[use_custom_mcc],
189
  outputs=[custom_mcc_input]
190
  )
191
-
192
  recommend_btn = gr.Button(
193
  "๐Ÿš€ Get Recommendation",
194
  variant="primary",
195
  size="lg"
196
  )
197
-
198
  with gr.Column(scale=2):
199
  gr.Markdown("### ๐Ÿ’ก Recommendation")
200
-
201
  recommendation_output = gr.Markdown(
202
  value="โœจ Select a category and merchant, then click 'Get Recommendation'",
203
  elem_classes=["recommendation-output"]
204
  )
205
-
206
  def update_merchant_choices(category):
207
  """Update merchant dropdown based on selected category"""
208
  merchants = MERCHANTS_BY_CATEGORY.get(category, ["Custom Merchant"])
@@ -210,24 +272,24 @@ Get AI-powered credit card recommendations that maximize your rewards based on:
210
  choices=merchants,
211
  value=merchants[0] if merchants else ""
212
  )
213
-
214
  # Connect category change to merchant update
215
  category_dropdown.change(
216
  fn=update_merchant_choices,
217
  inputs=[category_dropdown],
218
  outputs=[merchant_dropdown]
219
  )
220
-
221
  # Stats and comparison below
222
  with gr.Row():
223
  with gr.Column():
224
  gr.Markdown("### ๐Ÿ“Š Quick Stats")
225
  stats_output = gr.Markdown()
226
-
227
  with gr.Column():
228
  gr.Markdown("### ๐Ÿ”„ Card Comparison")
229
  comparison_output = gr.Markdown()
230
-
231
  # Connect button to function
232
  recommend_btn.click(
233
  fn=get_recommendation,
@@ -246,7 +308,7 @@ Get AI-powered credit card recommendations that maximize your rewards based on:
246
  stats_output
247
  ]
248
  )
249
-
250
  # Examples
251
  gr.Markdown("### ๐Ÿ“ Example Transactions")
252
  gr.Examples(
@@ -268,28 +330,131 @@ Get AI-powered credit card recommendations that maximize your rewards based on:
268
  fn=get_recommendation,
269
  cache_examples=False
270
  )
271
-
272
- # ========== Tab 2: About ==========
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  with gr.Tab("โ„น๏ธ About"):
274
  gr.Markdown(
275
  """
276
  ## About RewardPilot
 
277
  RewardPilot is an AI-powered credit card recommendation system built using the **Model Context Protocol (MCP)** architecture.
278
 
279
  ### ๐Ÿ—๏ธ Architecture
 
280
  The system consists of multiple microservices:
 
281
  1. **Smart Wallet** - Analyzes transaction context and selects optimal cards
282
  2. **Rewards-RAG** - Retrieves detailed card benefit information using RAG
283
  3. **Spend-Forecast** - Predicts spending patterns and warns about cap risks
284
  4. **Orchestrator** - Coordinates all services for comprehensive recommendations
285
 
286
  ### ๐ŸŽฏ How It Works
 
287
  1. **Enter Transaction Details** - Merchant, amount, category
288
  2. **AI Analysis** - System analyzes your wallet and transaction context
289
  3. **Get Recommendation** - Receive the best card with detailed reasoning
290
  4. **Maximize Rewards** - Earn more points/cashback on every purchase
291
 
292
  ### ๐Ÿ”ง Technology Stack
 
293
  - **Backend:** FastAPI, Python
294
  - **Frontend:** Gradio
295
  - **AI/ML:** RAG (Retrieval-Augmented Generation)
@@ -297,6 +462,7 @@ The system consists of multiple microservices:
297
  - **Deployment:** Hugging Face Spaces
298
 
299
  ### ๐Ÿ“š MCC Categories Supported
 
300
  - Groceries (5411)
301
  - Restaurants (5812)
302
  - Gas Stations (5541)
@@ -306,27 +472,32 @@ The system consists of multiple microservices:
306
  - And many more...
307
 
308
  ### ๐ŸŽ“ Built For
 
309
  **MCP 1st Birthday Hackathon** - Celebrating one year of the Model Context Protocol
310
 
311
  ### ๐Ÿ‘จโ€๐Ÿ’ป Developer
 
312
  Built with โค๏ธ for the MCP community
313
 
314
  ---
 
315
  **Version:** 1.0.0
316
  **Last Updated:** November 2025
317
  """
318
  )
319
-
320
- # ========== Tab 3: API Documentation ==========
321
  with gr.Tab("๐Ÿ“– API Docs"):
322
  gr.Markdown(
323
  """
324
  ## API Endpoints
325
 
326
  ### Orchestrator API
 
327
  **Base URL:** `https://mcp-1st-birthday-rewardpilot-orchestrator.hf.space`
328
 
329
  #### POST `/recommend`
 
330
  Get comprehensive card recommendation.
331
 
332
  **Request:**
@@ -363,18 +534,21 @@ Get comprehensive card recommendation.
363
  ```
364
 
365
  ### Other Services
 
366
  - Smart Wallet: https://mcp-1st-birthday-rewardpilot-smart-wallet.hf.space
367
  - Rewards-RAG: https://mcp-1st-birthday-rewardpilot-rewards-rag.hf.space
368
  - Spend-Forecast: https://mcp-1st-birthday-rewardpilot-spend-forecast.hf.space
369
 
370
  ### Interactive Docs
 
371
  Visit `/docs` on any service for interactive Swagger UI documentation.
372
 
373
  ### cURL Examples
 
374
  ```bash
375
  # Get recommendation
376
- curl -X POST https://mcp-1st-birthday-rewardpilot-orchestrator.hf.space/recommend \
377
- -H "Content-Type: application/json" \
378
  -d '{
379
  "user_id": "u_alice",
380
  "merchant": "Whole Foods",
 
36
  None,
37
  None,
38
  )
39
+
40
  # Determine MCC code
41
  if use_custom_mcc and custom_mcc:
42
  mcc = custom_mcc
43
  else:
44
  mcc = MCC_CATEGORIES.get(category, "5999")
45
+
46
  # Set default date if not provided
47
  if not transaction_date:
48
  transaction_date = str(date.today())
49
+
50
  # Call API
51
  response: Dict[str, Any] = client.get_recommendation_sync(
52
  user_id=user_id,
 
55
  amount_usd=amount,
56
  transaction_date=transaction_date,
57
  )
58
+
59
  # Format response
60
  formatted_text = format_full_recommendation(response)
61
+
62
  # Extract card details for comparison
63
  comparison_table: Optional[str]
64
  stats: Optional[str]
 
67
  alternatives: List[Dict[str, Any]] = response.get("alternative_cards", []) or []
68
  all_cards = [c for c in ([recommended] + alternatives) if c]
69
  comparison_table = format_comparison_table(all_cards) if all_cards else None
70
+
71
  # Create summary stats
72
  total_analyzed = response.get("total_cards_analyzed", len(all_cards))
73
  best_reward = (recommended.get("reward_amount") or 0.0)
 
80
  else:
81
  comparison_table = None
82
  stats = None
83
+
84
  return formatted_text, comparison_table, stats
85
 
86
  # ===================== Sample Transaction Examples =====================
 
107
  font-size: 16px;
108
  line-height: 1.6;
109
  }
110
+ /* Metric Cards Styling */
111
+ .metric-card {
112
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
113
+ color: white;
114
+ padding: 30px 20px;
115
+ border-radius: 16px;
116
+ text-align: center;
117
+ box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
118
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
119
+ margin: 10px;
120
+ }
121
+ .metric-card:hover {
122
+ transform: translateY(-5px);
123
+ box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
124
+ }
125
+ .metric-card h2 {
126
+ font-size: 48px;
127
+ font-weight: 700;
128
+ margin: 0 0 10px 0;
129
+ color: white;
130
+ }
131
+ .metric-card p {
132
+ font-size: 16px;
133
+ margin: 0;
134
+ opacity: 0.9;
135
+ color: white;
136
+ }
137
+ .metric-card-green {
138
+ background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
139
+ }
140
+ .metric-card-orange {
141
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
142
+ }
143
+ .metric-card-blue {
144
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
145
+ }
146
+ /* Table styling */
147
+ table {
148
+ width: 100%;
149
+ border-collapse: collapse;
150
+ margin: 20px 0;
151
+ background: white;
152
+ border-radius: 8px;
153
+ overflow: hidden;
154
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
155
+ }
156
+ table th {
157
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
158
+ color: white;
159
+ padding: 12px;
160
+ text-align: left;
161
+ font-weight: 600;
162
+ }
163
+ table td {
164
+ padding: 12px;
165
+ border-bottom: 1px solid #f0f0f0;
166
+ }
167
+ table tr:last-child td {
168
+ border-bottom: none;
169
+ }
170
+ table tr:hover {
171
+ background: #f8f9fa;
172
+ }
173
  """,
174
  ) as app:
175
  # Header
 
177
  f"""
178
  # {APP_TITLE}
179
  {APP_DESCRIPTION}
180
+
181
  Get AI-powered credit card recommendations that maximize your rewards based on:
182
  - ๐Ÿ’ฐ **Reward Rates** - Optimal card selection for each purchase
183
  - ๐Ÿ“š **Card Benefits** - Detailed information from our knowledge base
184
  - โš ๏ธ **Spending Caps** - Risk warnings to avoid missing out on bonuses
185
+
186
  ---
187
  """
188
  )
189
+
190
+ # Ensure all tabs are siblings at the same level
191
  with gr.Tabs():
 
192
  # ========== Tab 1: Get Recommendation ==========
193
  with gr.Tab("๐ŸŽฏ Get Recommendation"):
194
  with gr.Row():
195
  with gr.Column(scale=1):
196
  gr.Markdown("### Transaction Details")
 
197
  user_dropdown = gr.Dropdown(
198
  choices=SAMPLE_USERS,
199
  value=SAMPLE_USERS[0],
200
  label="User ID",
201
  info="Select a user"
202
  )
203
+
204
  # CATEGORY FIRST (moved up)
205
  category_dropdown = gr.Dropdown(
206
  choices=list(MCC_CATEGORIES.keys()),
 
208
  label="๐Ÿท๏ธ Type of Purchase",
209
  info="Select the category first"
210
  )
211
+
212
  # MERCHANT DROPDOWN (now dynamic)
213
  merchant_dropdown = gr.Dropdown(
214
  choices=MERCHANTS_BY_CATEGORY["Groceries"],
 
217
  info="Select merchant (changes based on category)",
218
  allow_custom_value=True # Allows typing custom merchants
219
  )
220
+
221
  amount_input = gr.Number(
222
  label="๐Ÿ’ต Amount (USD)",
223
  value=125.50,
224
  minimum=0.01,
225
  step=0.01
226
  )
227
+
228
  date_input = gr.Textbox(
229
  label="๐Ÿ“… Transaction Date (Optional)",
230
  placeholder="YYYY-MM-DD or leave blank for today",
231
  value=""
232
  )
233
+
234
  # Advanced options
235
  with gr.Accordion("โš™๏ธ Advanced Options", open=False):
236
  use_custom_mcc = gr.Checkbox(
 
242
  placeholder="e.g., 5411",
243
  visible=False
244
  )
245
+
246
  def toggle_custom_mcc(use_custom):
247
  return gr.update(visible=use_custom)
248
+
249
  use_custom_mcc.change(
250
  fn=toggle_custom_mcc,
251
  inputs=[use_custom_mcc],
252
  outputs=[custom_mcc_input]
253
  )
254
+
255
  recommend_btn = gr.Button(
256
  "๐Ÿš€ Get Recommendation",
257
  variant="primary",
258
  size="lg"
259
  )
260
+
261
  with gr.Column(scale=2):
262
  gr.Markdown("### ๐Ÿ’ก Recommendation")
 
263
  recommendation_output = gr.Markdown(
264
  value="โœจ Select a category and merchant, then click 'Get Recommendation'",
265
  elem_classes=["recommendation-output"]
266
  )
267
+
268
  def update_merchant_choices(category):
269
  """Update merchant dropdown based on selected category"""
270
  merchants = MERCHANTS_BY_CATEGORY.get(category, ["Custom Merchant"])
 
272
  choices=merchants,
273
  value=merchants[0] if merchants else ""
274
  )
275
+
276
  # Connect category change to merchant update
277
  category_dropdown.change(
278
  fn=update_merchant_choices,
279
  inputs=[category_dropdown],
280
  outputs=[merchant_dropdown]
281
  )
282
+
283
  # Stats and comparison below
284
  with gr.Row():
285
  with gr.Column():
286
  gr.Markdown("### ๐Ÿ“Š Quick Stats")
287
  stats_output = gr.Markdown()
288
+
289
  with gr.Column():
290
  gr.Markdown("### ๐Ÿ”„ Card Comparison")
291
  comparison_output = gr.Markdown()
292
+
293
  # Connect button to function
294
  recommend_btn.click(
295
  fn=get_recommendation,
 
308
  stats_output
309
  ]
310
  )
311
+
312
  # Examples
313
  gr.Markdown("### ๐Ÿ“ Example Transactions")
314
  gr.Examples(
 
330
  fn=get_recommendation,
331
  cache_examples=False
332
  )
333
+
334
+ # ========== Tab 2: Analytics (NEW) ==========
335
+ with gr.Tab("๐Ÿ“Š Analytics"):
336
+ gr.Markdown("## ๐ŸŽฏ Your Rewards Optimization Dashboard")
337
+
338
+ # Top Metrics Row
339
+ with gr.Row():
340
+ with gr.Column(scale=1):
341
+ gr.HTML("""
342
+ <div class="metric-card">
343
+ <h2>$342</h2>
344
+ <p>๐Ÿ’ฐ Potential Annual Savings</p>
345
+ </div>
346
+ """)
347
+
348
+ with gr.Column(scale=1):
349
+ gr.HTML("""
350
+ <div class="metric-card metric-card-green">
351
+ <h2>23%</h2>
352
+ <p>๐Ÿ“ˆ Rewards Rate Increase</p>
353
+ </div>
354
+ """)
355
+
356
+ with gr.Column(scale=1):
357
+ gr.HTML("""
358
+ <div class="metric-card metric-card-orange">
359
+ <h2>156</h2>
360
+ <p>โœ… Optimized Transactions</p>
361
+ </div>
362
+ """)
363
+
364
+ with gr.Column(scale=1):
365
+ gr.HTML("""
366
+ <div class="metric-card metric-card-blue">
367
+ <h2>87/100</h2>
368
+ <p>โญ Optimization Score</p>
369
+ </div>
370
+ """)
371
+
372
+ gr.Markdown("---")
373
+
374
+ # Detailed Analytics
375
+ with gr.Row():
376
+ with gr.Column(scale=1):
377
+ gr.Markdown("### ๐Ÿ’ฐ Category Spending Breakdown")
378
+ gr.Markdown("""
379
+ | Category | Monthly Spend | Best Card | Rewards | Rate |
380
+ |----------|---------------|-----------|---------|------|
381
+ | ๐Ÿ›’ Groceries | $450.00 | Amex Gold | $27.00 | 6% |
382
+ | ๐Ÿฝ๏ธ Restaurants | $320.00 | Amex Gold | $12.80 | 4% |
383
+ | โ›ฝ Gas | $180.00 | Costco Visa | $7.20 | 4% |
384
+ | โœˆ๏ธ Travel | $850.00 | Sapphire Reserve | $42.50 | 5% |
385
+ | ๐ŸŽฌ Entertainment | $125.00 | Freedom Unlimited | $1.88 | 1.5% |
386
+ | ๐Ÿช Online Shopping | $280.00 | Amazon Prime | $16.80 | 6% |
387
+ | **Total** | **$2,205.00** | - | **$108.18** | **4.9%** |
388
+ """)
389
+
390
+ with gr.Column(scale=1):
391
+ gr.Markdown("### ๐Ÿ“ˆ Monthly Trends & Insights")
392
+
393
+ gr.Markdown("""
394
+ **๐Ÿ”ฅ Top Spending Categories:**
395
+ 1. โœˆ๏ธ Travel: $850 (โ†‘ 45% from last month)
396
+ 2. ๐Ÿ›’ Groceries: $450 (โ†‘ 12%)
397
+ 3. ๐Ÿฝ๏ธ Restaurants: $320 (โ†“ 5%)
398
+
399
+ **๐Ÿ’ก Optimization Opportunities:**
400
+ - โœ… You're using optimal cards 87% of the time
401
+ - ๐ŸŽฏ Switch to Chase Freedom for Q4 5% grocery bonus
402
+ - โš ๏ธ Amex Gold dining cap approaching ($2,000 limit)
403
+ - ๐Ÿ’ณ Consider applying for Citi Custom Cash
404
+
405
+ **๐Ÿ† Best Performing Card:**
406
+ Chase Sapphire Reserve - $42.50 rewards earned
407
+
408
+ **๐Ÿ“Š Year-to-Date:**
409
+ - Total Rewards: $1,298.16
410
+ - Potential if optimized: $1,640.00
411
+ - **Money left on table: $341.84**
412
+ """)
413
+
414
+ gr.Markdown("---")
415
+
416
+ # Spending Forecast
417
+ with gr.Row():
418
+ gr.Markdown("""
419
+ ### ๐Ÿ”ฎ Next Month Forecast
420
+
421
+ Based on your spending patterns:
422
+ - **Predicted Spend:** $2,350
423
+ - **Predicted Rewards:** $115.25
424
+ - **Cards to Watch:** Amex Gold (dining cap), Freedom (quarterly bonus)
425
+
426
+ **Recommendations:**
427
+ 1. ๐Ÿ’ณ Use Chase Freedom for groceries in Q4 (5% back)
428
+ 2. โš ๏ธ Monitor Amex Gold dining spend (cap at $2,000)
429
+ 3. ๐ŸŽฏ Book holiday travel with Sapphire Reserve for 5x points
430
+ """)
431
+
432
+ # ========== Tab 3: About ==========
433
  with gr.Tab("โ„น๏ธ About"):
434
  gr.Markdown(
435
  """
436
  ## About RewardPilot
437
+
438
  RewardPilot is an AI-powered credit card recommendation system built using the **Model Context Protocol (MCP)** architecture.
439
 
440
  ### ๐Ÿ—๏ธ Architecture
441
+
442
  The system consists of multiple microservices:
443
+
444
  1. **Smart Wallet** - Analyzes transaction context and selects optimal cards
445
  2. **Rewards-RAG** - Retrieves detailed card benefit information using RAG
446
  3. **Spend-Forecast** - Predicts spending patterns and warns about cap risks
447
  4. **Orchestrator** - Coordinates all services for comprehensive recommendations
448
 
449
  ### ๐ŸŽฏ How It Works
450
+
451
  1. **Enter Transaction Details** - Merchant, amount, category
452
  2. **AI Analysis** - System analyzes your wallet and transaction context
453
  3. **Get Recommendation** - Receive the best card with detailed reasoning
454
  4. **Maximize Rewards** - Earn more points/cashback on every purchase
455
 
456
  ### ๐Ÿ”ง Technology Stack
457
+
458
  - **Backend:** FastAPI, Python
459
  - **Frontend:** Gradio
460
  - **AI/ML:** RAG (Retrieval-Augmented Generation)
 
462
  - **Deployment:** Hugging Face Spaces
463
 
464
  ### ๐Ÿ“š MCC Categories Supported
465
+
466
  - Groceries (5411)
467
  - Restaurants (5812)
468
  - Gas Stations (5541)
 
472
  - And many more...
473
 
474
  ### ๐ŸŽ“ Built For
475
+
476
  **MCP 1st Birthday Hackathon** - Celebrating one year of the Model Context Protocol
477
 
478
  ### ๐Ÿ‘จโ€๐Ÿ’ป Developer
479
+
480
  Built with โค๏ธ for the MCP community
481
 
482
  ---
483
+
484
  **Version:** 1.0.0
485
  **Last Updated:** November 2025
486
  """
487
  )
488
+
489
+ # ========== Tab 4: API Documentation ==========
490
  with gr.Tab("๐Ÿ“– API Docs"):
491
  gr.Markdown(
492
  """
493
  ## API Endpoints
494
 
495
  ### Orchestrator API
496
+
497
  **Base URL:** `https://mcp-1st-birthday-rewardpilot-orchestrator.hf.space`
498
 
499
  #### POST `/recommend`
500
+
501
  Get comprehensive card recommendation.
502
 
503
  **Request:**
 
534
  ```
535
 
536
  ### Other Services
537
+
538
  - Smart Wallet: https://mcp-1st-birthday-rewardpilot-smart-wallet.hf.space
539
  - Rewards-RAG: https://mcp-1st-birthday-rewardpilot-rewards-rag.hf.space
540
  - Spend-Forecast: https://mcp-1st-birthday-rewardpilot-spend-forecast.hf.space
541
 
542
  ### Interactive Docs
543
+
544
  Visit `/docs` on any service for interactive Swagger UI documentation.
545
 
546
  ### cURL Examples
547
+
548
  ```bash
549
  # Get recommendation
550
+ curl -X POST https://mcp-1st-birthday-rewardpilot-orchestrator.hf.space/recommend \\
551
+ -H "Content-Type: application/json" \\
552
  -d '{
553
  "user_id": "u_alice",
554
  "merchant": "Whole Foods",