Vaibhav84 commited on
Commit
31f56d4
·
1 Parent(s): 0818c89
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -257,24 +257,24 @@ def get_content_recommendations(customer_id: str, n: int = 5) -> List[Dict]:
257
 
258
  # Age-based recommendations
259
  age = customer_profile['Age'] * scaler.scale_[0] + scaler.mean_[0] # Denormalize age
260
-
261
  if age < 25:
262
  content_suggestions.extend([
263
- {"type": "Video", "title": "Getting Started with Personal Finance", "category": "Financial Education"},
264
- {"type": "Article", "title": "Budgeting Basics for Young Adults", "category": "Financial Planning"},
265
- {"type": "Interactive", "title": "Investment 101 Quiz", "category": "Education"}
266
  ])
267
  elif age < 40:
268
  content_suggestions.extend([
269
- {"type": "Video", "title": "Investment Strategies for Growing Wealth", "category": "Investment"},
270
- {"type": "Article", "title": "Family Financial Planning Guide", "category": "Financial Planning"},
271
- {"type": "Webinar", "title": "Real Estate Investment Basics", "category": "Investment"}
272
  ])
273
  else:
274
  content_suggestions.extend([
275
- {"type": "Video", "title": "Retirement Planning Strategies", "category": "Retirement"},
276
- {"type": "Article", "title": "Estate Planning Essentials", "category": "Financial Planning"},
277
- {"type": "Webinar", "title": "Tax Optimization for Retirement", "category": "Tax Planning"}
278
  ])
279
 
280
  # Income-based recommendations
@@ -282,18 +282,18 @@ def get_content_recommendations(customer_id: str, n: int = 5) -> List[Dict]:
282
 
283
  if income < 50000:
284
  content_suggestions.extend([
285
- {"type": "Video", "title": "Debt Management Strategies", "category": "Debt Management"},
286
- {"type": "Article", "title": "Saving on a Tight Budget", "category": "Budgeting"}
287
  ])
288
  elif income < 100000:
289
  content_suggestions.extend([
290
- {"type": "Video", "title": "Tax-Efficient Investment Strategies", "category": "Investment"},
291
- {"type": "Article", "title": "Maximizing Your 401(k)", "category": "Retirement"}
292
  ])
293
  else:
294
  content_suggestions.extend([
295
- {"type": "Video", "title": "Advanced Tax Planning Strategies", "category": "Tax Planning"},
296
- {"type": "Article", "title": "High-Net-Worth Investment Guide", "category": "Investment"}
297
  ])
298
 
299
  # Add personalization based on purchase history
@@ -364,8 +364,8 @@ async def get_customer_content_recommendations(customer_id: str, n: int = 5):
364
  return {
365
  "customer_id": customer_id,
366
  "profile_summary": profile_summary,
367
- "recommendations": recommendations,
368
- "AIContent":cleaned_response
369
  }
370
 
371
  except HTTPException:
 
257
 
258
  # Age-based recommendations
259
  age = customer_profile['Age'] * scaler.scale_[0] + scaler.mean_[0] # Denormalize age
260
+ cleaned_response= Get_contentDescription('Getting Started with Personal Finance')
261
  if age < 25:
262
  content_suggestions.extend([
263
+ {"type": "Video", "title": "Getting Started with Personal Finance", "category": "Financial Education", "descrption":cleaned_response},
264
+ {"type": "Article", "title": "Budgeting Basics for Young Adults", "category": "Financial Planning" ,"descrption":cleaned_response},
265
+ {"type": "Interactive", "title": "Investment 101 Quiz", "category": "Education", "descrption":cleaned_response}
266
  ])
267
  elif age < 40:
268
  content_suggestions.extend([
269
+ {"type": "Video", "title": "Investment Strategies for Growing Wealth", "category": "Investment", "descrption":cleaned_response},
270
+ {"type": "Article", "title": "Family Financial Planning Guide", "category": "Financial Planning", "descrption":cleaned_response},
271
+ {"type": "Webinar", "title": "Real Estate Investment Basics", "category": "Investment", "descrption":cleaned_response}
272
  ])
273
  else:
274
  content_suggestions.extend([
275
+ {"type": "Video", "title": "Retirement Planning Strategies", "category": "Retirement", "descrption":cleaned_response},
276
+ {"type": "Article", "title": "Estate Planning Essentials", "category": "Financial Planning", "descrption":cleaned_response},
277
+ {"type": "Webinar", "title": "Tax Optimization for Retirement", "category": "Tax Planning", "descrption":cleaned_response}
278
  ])
279
 
280
  # Income-based recommendations
 
282
 
283
  if income < 50000:
284
  content_suggestions.extend([
285
+ {"type": "Video", "title": "Debt Management Strategies", "category": "Debt Management", "descrption":cleaned_response},
286
+ {"type": "Article", "title": "Saving on a Tight Budget", "category": "Budgeting", "descrption":cleaned_response}
287
  ])
288
  elif income < 100000:
289
  content_suggestions.extend([
290
+ {"type": "Video", "title": "Tax-Efficient Investment Strategies", "category": "Investment", "descrption":cleaned_response},
291
+ {"type": "Article", "title": "Maximizing Your 401(k)", "category": "Retirement", "descrption":cleaned_response}
292
  ])
293
  else:
294
  content_suggestions.extend([
295
+ {"type": "Video", "title": "Advanced Tax Planning Strategies", "category": "Tax Planning", "descrption":cleaned_response},
296
+ {"type": "Article", "title": "High-Net-Worth Investment Guide", "category": "Investment", "descrption":cleaned_response}
297
  ])
298
 
299
  # Add personalization based on purchase history
 
364
  return {
365
  "customer_id": customer_id,
366
  "profile_summary": profile_summary,
367
+ "recommendations": recommendations
368
+
369
  }
370
 
371
  except HTTPException: