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

Update prompt_builder.py

Browse files
Files changed (1) hide show
  1. prompt_builder.py +16 -37
prompt_builder.py CHANGED
@@ -1,45 +1,24 @@
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
- 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
 
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