srbhavya01 commited on
Commit
a527bf1
·
verified ·
1 Parent(s): 9750092

Update prompt_builder.py

Browse files
Files changed (1) hide show
  1. prompt_builder.py +45 -16
prompt_builder.py CHANGED
@@ -1,24 +1,53 @@
1
- def build_prompt(name, age, gender, height, weight, goal, fitness_level, equipment):
 
 
2
 
3
- bmi = calculate_bmi(height, weight)
4
- status = bmi_category(bmi)
 
 
 
 
 
 
 
5
 
6
- prompt = f"""
7
- Create a 5-day workout plan.
8
 
9
- Name: {name}
10
- Age: {age}
11
- Gender: {gender}
12
- Height: {height} cm
13
- Weight: {weight} kg
14
- BMI: {bmi:.2f} ({status})
 
 
 
15
 
16
- Goal: {goal}
17
- Fitness Level: {fitness_level}
18
 
19
- Available Equipment: {', '.join(equipment)}
20
 
21
- Provide a structured 5 day workout plan with sets and reps.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  """
23
 
24
- return prompt, bmi, status
 
1
+ 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"
8
+ elif bmi < 25:
9
+ return "Normal Weight"
10
+ elif bmi < 30:
11
+ return "Overweight"
12
+ else:
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)
28
 
29
+ equipment_list = ", ".join(equipment) if equipment else "No Equipment"
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