Vaibhav84 commited on
Commit
fbff3c3
·
1 Parent(s): 006fe8b
Files changed (1) hide show
  1. app.py +19 -22
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
- 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,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", "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
@@ -306,15 +306,13 @@ def get_content_recommendations(customer_id: str, n: int = 5) -> List[Dict]:
306
  content_suggestions.append({
307
  "type": "Video",
308
  "title": f"Advanced {category} Strategies",
309
- "category": category,
310
- "descrption":cleaned_response
311
  })
312
  elif category == 'Insurance':
313
  content_suggestions.append({
314
  "type": "Article",
315
  "title": f"Understanding Your {category} Options",
316
- "category": category,
317
- "descrption":cleaned_response
318
  })
319
 
320
  # Remove duplicates and limit to n recommendations
@@ -362,12 +360,11 @@ async def get_customer_content_recommendations(customer_id: str, n: int = 5):
362
 
363
  # Get content recommendations
364
  recommendations = get_content_recommendations(customer_id, n)
365
- cleaned_response= Get_contentDescription('Getting Started with Personal Finance')
366
  return {
367
  "customer_id": customer_id,
368
  "profile_summary": profile_summary,
369
  "recommendations": recommendations
370
-
371
  }
372
 
373
  except HTTPException:
 
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
 
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
 
306
  content_suggestions.append({
307
  "type": "Video",
308
  "title": f"Advanced {category} Strategies",
309
+ "category": category
 
310
  })
311
  elif category == 'Insurance':
312
  content_suggestions.append({
313
  "type": "Article",
314
  "title": f"Understanding Your {category} Options",
315
+ "category": category
 
316
  })
317
 
318
  # Remove duplicates and limit to n recommendations
 
360
 
361
  # Get content recommendations
362
  recommendations = get_content_recommendations(customer_id, n)
363
+
364
  return {
365
  "customer_id": customer_id,
366
  "profile_summary": profile_summary,
367
  "recommendations": recommendations
 
368
  }
369
 
370
  except HTTPException: