srbhavya01 commited on
Commit
32b2c76
·
verified ·
1 Parent(s): a0bd637

Update prompt_builder.py

Browse files
Files changed (1) hide show
  1. 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
- Create a structured 5-day personalized workout plan.
26
-
27
- User Profile:
28
- - Name: {name}
29
- - Age: {age}
30
- - Gender: {gender}
31
- - Height: {height} cm
32
- - Weight: {weight} kg
33
- - BMI: {bmi:.2f} ({bmi_status})
34
- - Goal: {goal}
35
- - Fitness Level: {fitness_level}
36
- - Available Equipment: {equipment_list}
37
-
38
- Instructions:
39
- 1. Divide clearly into Day 1 to Day 5.
40
- 2. Include exercise name.
41
- 3. Include sets and reps.
42
- 4. Include rest period.
43
- 5. Adjust intensity based on BMI category AND age.
44
- 6. Avoid unsafe exercises for beginners or older users.
45
- 7. Keep the plan professional and easy to follow.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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