srbhavya01 commited on
Commit
dff8f76
·
verified ·
1 Parent(s): aa33200

Update prompt_builder.py

Browse files
Files changed (1) hide show
  1. prompt_builder.py +19 -67
prompt_builder.py CHANGED
@@ -2,7 +2,6 @@ def calculate_bmi(weight, height):
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"
@@ -14,7 +13,7 @@ def bmi_category(bmi):
14
  return "Obese"
15
 
16
 
17
- def build_prompt(name, age, gender, height, weight, goal, fitness_level, equipment):
18
 
19
  bmi = calculate_bmi(weight, height)
20
  bmi_status = bmi_category(bmi)
@@ -23,71 +22,24 @@ def build_prompt(name, age, gender, height, weight, goal, fitness_level, equipme
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
 
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"
 
13
  return "Obese"
14
 
15
 
16
+ def build_prompt(name, gender, height, weight, goal, fitness_level, equipment):
17
 
18
  bmi = calculate_bmi(weight, height)
19
  bmi_status = bmi_category(bmi)
 
22
 
23
  prompt = f"""
24
  You are a certified professional fitness trainer.
25
+ Create a structured 5-day personalized workout plan.
26
+ User Profile:
27
+ - Name: {name}
28
+ - Gender: {gender}
29
+ - Height: {height} cm
30
+ - Weight: {weight} kg
31
+ - BMI: {bmi:.2f} ({bmi_status})
32
+ - Goal: {goal}
33
+ - Fitness Level: {fitness_level}
34
+ - Available Equipment: {equipment_list}
35
+ Instructions:
36
+ 1. Divide clearly into Day 1 to Day 5.
37
+ 2. Include exercise name.
38
+ 3. Include sets and reps.
39
+ 4. Include rest period.
40
+ 5. Adjust intensity based on BMI category.
41
+ 6. Avoid unsafe exercises for beginners.
42
+ 7. Keep the plan professional and easy to follow.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  """
44
 
45
  return prompt, bmi, bmi_status