Springboardmen commited on
Commit
fc40a2c
·
verified ·
1 Parent(s): 510d3ef

Update prompt_builder.py

Browse files
Files changed (1) hide show
  1. prompt_builder.py +39 -12
prompt_builder.py CHANGED
@@ -1,21 +1,48 @@
1
- def build_prompt(goal, fitness_level, equipment):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  prompt = f"""
4
  You are a certified professional fitness trainer.
5
 
6
- Create a detailed 5-day workout plan.
7
 
8
- User Information:
 
 
 
 
 
9
  - Goal: {goal}
10
  - Fitness Level: {fitness_level}
11
- - Equipment Available: {equipment}
12
-
13
- Requirements:
14
- - Clearly divide days (Day 1, Day 2, etc.)
15
- - Include exercise name
16
- - Include sets and reps
17
- - Include rest period
18
- - Keep it structured and professional
 
 
19
  """
20
 
21
- return prompt
 
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 build_prompt(name, gender, height, weight, goal, fitness_level, equipment):
17
+
18
+ bmi = calculate_bmi(weight, height)
19
+ bmi_status = bmi_category(bmi)
20
+
21
+ equipment_list = ", ".join(equipment) if equipment else "No Equipment"
22
 
23
  prompt = f"""
24
  You are a certified professional fitness trainer.
25
 
26
+ Create a structured 5-day personalized workout plan.
27
 
28
+ User Profile:
29
+ - Name: {name}
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.
44
+ 6. Avoid unsafe exercises for beginners.
45
+ 7. Keep the plan professional and easy to follow.
46
  """
47
 
48
+ return prompt, bmi, bmi_status