srbhavya01 commited on
Commit
730a89b
·
verified ·
1 Parent(s): 27e5aad

Update prompt_builder.py

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