Spaces:
Running
Running
Update prompt_builder.py
Browse files- prompt_builder.py +67 -21
prompt_builder.py
CHANGED
|
@@ -2,6 +2,7 @@ def calculate_bmi(weight, height):
|
|
| 2 |
height_m = height / 100
|
| 3 |
return weight / (height_m ** 2)
|
| 4 |
|
|
|
|
| 5 |
def bmi_category(bmi):
|
| 6 |
if bmi < 18.5:
|
| 7 |
return "Underweight"
|
|
@@ -22,26 +23,71 @@ def build_prompt(name, age, gender, height, weight, goal, fitness_level, equipme
|
|
| 22 |
|
| 23 |
prompt = f"""
|
| 24 |
You are a certified professional fitness trainer.
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
"""
|
|
|
|
| 47 |
return prompt, bmi, bmi_status
|
|
|
|
| 2 |
height_m = height / 100
|
| 3 |
return weight / (height_m ** 2)
|
| 4 |
|
| 5 |
+
|
| 6 |
def bmi_category(bmi):
|
| 7 |
if bmi < 18.5:
|
| 8 |
return "Underweight"
|
|
|
|
| 23 |
|
| 24 |
prompt = f"""
|
| 25 |
You are a certified professional fitness trainer.
|
| 26 |
+
|
| 27 |
+
Create a 5-day personalized workout plan for the user.
|
| 28 |
+
|
| 29 |
+
USER PROFILE
|
| 30 |
+
Name: {name}
|
| 31 |
+
Age: {age}
|
| 32 |
+
Gender: {gender}
|
| 33 |
+
Height: {height} cm
|
| 34 |
+
Weight: {weight} kg
|
| 35 |
+
BMI: {bmi:.2f} ({bmi_status})
|
| 36 |
+
Goal: {goal}
|
| 37 |
+
Fitness Level: {fitness_level}
|
| 38 |
+
Available Equipment: {equipment_list}
|
| 39 |
+
|
| 40 |
+
INSTRUCTIONS
|
| 41 |
+
|
| 42 |
+
1. Create a workout plan from Day 1 to Day 5.
|
| 43 |
+
2. Each day must contain 3–4 exercises.
|
| 44 |
+
3. Each exercise must include:
|
| 45 |
+
- Exercise Name
|
| 46 |
+
- Sets
|
| 47 |
+
- Reps
|
| 48 |
+
- Rest Time
|
| 49 |
+
4. Adjust intensity based on BMI, age, and fitness level.
|
| 50 |
+
5. Avoid unsafe exercises for beginners.
|
| 51 |
+
|
| 52 |
+
OUTPUT FORMAT (VERY IMPORTANT)
|
| 53 |
+
|
| 54 |
+
Write the workout like step-by-step instructions.
|
| 55 |
+
|
| 56 |
+
Example:
|
| 57 |
+
|
| 58 |
+
Day 1 – Upper Body
|
| 59 |
+
|
| 60 |
+
1. Push-Ups
|
| 61 |
+
Sets: 3
|
| 62 |
+
Reps: 10-12
|
| 63 |
+
Rest: 60 seconds
|
| 64 |
+
|
| 65 |
+
2. Dumbbell Shoulder Press
|
| 66 |
+
Sets: 3
|
| 67 |
+
Reps: 8-10
|
| 68 |
+
Rest: 60 seconds
|
| 69 |
+
|
| 70 |
+
3. Bent Over Rows
|
| 71 |
+
Sets: 3
|
| 72 |
+
Reps: 10
|
| 73 |
+
Rest: 45 seconds
|
| 74 |
+
|
| 75 |
+
Day 2 – Lower Body
|
| 76 |
+
|
| 77 |
+
1. Bodyweight Squats
|
| 78 |
+
Sets: 3
|
| 79 |
+
Reps: 12
|
| 80 |
+
Rest: 60 seconds
|
| 81 |
+
|
| 82 |
+
2. Lunges
|
| 83 |
+
Sets: 3
|
| 84 |
+
Reps: 10 each leg
|
| 85 |
+
Rest: 45 seconds
|
| 86 |
+
|
| 87 |
+
Continue until Day 5.
|
| 88 |
+
|
| 89 |
+
Do not include explanations.
|
| 90 |
+
Only provide the workout instructions.
|
| 91 |
"""
|
| 92 |
+
|
| 93 |
return prompt, bmi, bmi_status
|