Amrutha04 commited on
Commit
dd8f7ab
·
verified ·
1 Parent(s): dbf471f

Create diet_builder.py

Browse files
Files changed (1) hide show
  1. diet_builder.py +29 -0
diet_builder.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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