Spaces:
Sleeping
Sleeping
Download diet_builder.py from Amrutha04/Fit_Plan_Module_2: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/Amrutha04/Fit_Plan_Module_2/resolve/main/diet_builder.py
- Command line
-
hf download hf://spaces/Amrutha04/Fit_Plan_Module_2/diet_builder.py
-
curl -L -o diet_builder.py https://huggingface.co/spaces/Amrutha04/Fit_Plan_Module_2/resolve/main/diet_builder.py
770 Bytes
| def build_diet_prompt(name, gender, age, height, weight, goal): | |
| bmi = weight / ((height / 100) ** 2) | |
| # Custom instructions based on Goal | |
| if goal == "Weight Loss": | |
| diet_type = "Low carb, high protein, 500 calorie deficit" | |
| elif goal == "Build Muscle": | |
| diet_type = "High carb, high protein, 300 calorie surplus" | |
| else: | |
| diet_type = "Balanced macros, maintenance calories" | |
| prompt = f""" | |
| Act as a professional nutritionist for {name} ({gender}, {age}yo). | |
| Stats: BMI {bmi:.1f}, Goal: {goal}, Strategy: {diet_type}. | |
| STRICT FORMAT (One meal per line): | |
| Meal Name | Time | Ingredients | Calories | |
| Provide 4 unique meals. Use the | separator exactly. No conversational text. | |
| """ | |
| return prompt |