Spaces:
Sleeping
Sleeping
Update diet_builder.py
Browse files- 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 |
-
#
|
| 6 |
if goal == "Weight Loss":
|
| 7 |
-
|
| 8 |
elif goal == "Build Muscle":
|
| 9 |
-
|
| 10 |
-
elif goal == "Strength":
|
| 11 |
-
focus = "Maintenance or slight surplus, very high protein, and focus on micronutrients for recovery."
|
| 12 |
else:
|
| 13 |
-
|
| 14 |
|
| 15 |
prompt = f"""
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
STRICT FORMAT:
|
| 21 |
Meal Name | Time | Ingredients | Calories
|
| 22 |
-
|
| 23 |
-
|
| 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
|