Amrutha04 commited on
Commit
a7e88c2
·
verified ·
1 Parent(s): 9f8a8e0

Update diet_builder.py

Browse files
Files changed (1) hide show
  1. diet_builder.py +10 -18
diet_builder.py CHANGED
@@ -1,29 +1,21 @@
1
  def build_diet_prompt(name, gender, age, height, weight, goal):
2
- # Calculate BMI
3
  bmi = weight / ((height / 100) ** 2)
4
 
5
- # Determine the focus based on the goal
6
  if goal == "Weight Loss":
7
- focus = "Caloric deficit, high fiber, and moderate protein to retain muscle while losing fat."
8
  elif goal == "Build Muscle":
9
- focus = "Caloric surplus, high protein (1.6g-2g per kg), and complex carbohydrates for energy."
10
- elif goal == "Strength":
11
- focus = "Maintenance or slight surplus, very high protein, and focus on micronutrients for recovery."
12
  else:
13
- focus = "Balanced macros with a focus on whole foods and hydration."
14
 
15
  prompt = f"""
16
- You are a professional nutritionist. Create a 1-day sample meal plan for {name} ({gender}, {age} years old).
17
- User Info: BMI is {bmi:.1f}, Goal is {goal}.
18
- Focus: {focus}
19
-
20
- STRICT FORMAT:
21
  Meal Name | Time | Ingredients | Calories
22
- Example:
23
- - Breakfast | 8:00 AM | 3 Egg whites, 1 cup Oats, Blueberries | 350 kcal
24
- - Lunch | 1:30 PM | 150g Grilled Chicken, Brown Rice, Broccoli | 500 kcal
25
-
26
- Provide 4 meals: Breakfast, Lunch, Snack, and Dinner.
27
- Only output the list using the | separator. Do not include introductory text.
28
  """
29
  return prompt
 
1
  def build_diet_prompt(name, gender, age, height, weight, goal):
 
2
  bmi = weight / ((height / 100) ** 2)
3
 
4
+ # Custom instructions based on Goal
5
  if goal == "Weight Loss":
6
+ diet_type = "Low carb, high protein, 500 calorie deficit"
7
  elif goal == "Build Muscle":
8
+ diet_type = "High carb, high protein, 300 calorie surplus"
 
 
9
  else:
10
+ diet_type = "Balanced macros, maintenance calories"
11
 
12
  prompt = f"""
13
+ Act as a professional nutritionist for {name} ({gender}, {age}yo).
14
+ Stats: BMI {bmi:.1f}, Goal: {goal}, Strategy: {diet_type}.
15
+
16
+ STRICT FORMAT (One meal per line):
 
17
  Meal Name | Time | Ingredients | Calories
18
+
19
+ Provide 4 unique meals. Use the | separator exactly. No conversational text.
 
 
 
 
20
  """
21
  return prompt