FitPlan_5 / prompt_builder.py
Sreehitha-V's picture
Update prompt_builder.py
7e9e10d verified
def calculate_bmi(weight, height):
height_m = height / 100
return weight / (height_m ** 2)
def bmi_category(bmi):
if bmi < 18.5:
return "Underweight"
elif bmi < 25:
return "Normal Weight"
elif bmi < 30:
return "Overweight"
else:
return "Obese"
def build_prompt(name, gender, height, weight, goal, fitness_level, equipment):
bmi = calculate_bmi(weight, height)
bmi_status = bmi_category(bmi)
equipment_list = ", ".join(equipment) if equipment else "No Equipment"
prompt = f"""You are a certified professional fitness trainer.
Create a structured 5-day personalized workout plan.
User Profile:
- Name: {name}
- Gender: {gender}
- Height: {height} cm
- Weight: {weight} kg
- BMI: {bmi:.2f} ({bmi_status})
- Goal: {goal}
- Fitness Level: {fitness_level}
- Available Equipment: {equipment_list}
Instructions:
1. Divide clearly into Day 1 to Day 5 with headers like "## Day 1 - [Focus Area]"
2. For each day list 5-6 exercises.
3. Include sets x reps for each exercise.
4. Include rest period between sets.
5. Adjust intensity based on BMI category and fitness level.
6. Avoid unsafe exercises for beginners.
7. End with a brief motivational note for {name}.
8. Keep the plan professional, structured and easy to follow.
"""
return prompt, bmi, bmi_status