Spaces:
Running
Running
Update prompt_builder.py
Browse files- prompt_builder.py +15 -27
prompt_builder.py
CHANGED
|
@@ -4,45 +4,33 @@ def calculate_bmi(weight, height):
|
|
| 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 |
-
|
| 24 |
-
|
| 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 |
-
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
1.
|
| 40 |
-
2.
|
| 41 |
-
3.
|
| 42 |
-
4.
|
| 43 |
-
5.
|
| 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
|
|
|
|
| 4 |
|
| 5 |
def bmi_category(bmi):
|
| 6 |
if bmi < 18.5:
|
| 7 |
+
return "Underweight", "#3498db"
|
| 8 |
elif bmi < 25:
|
| 9 |
+
return "Normal Weight", "#2ecc71"
|
| 10 |
elif bmi < 30:
|
| 11 |
+
return "Overweight", "#f1c40f"
|
| 12 |
else:
|
| 13 |
+
return "Obese", "#e74c3c"
|
|
|
|
| 14 |
|
| 15 |
def build_prompt(name, gender, height, weight, goal, fitness_level, equipment):
|
|
|
|
| 16 |
bmi = calculate_bmi(weight, height)
|
| 17 |
+
bmi_status, status_color = bmi_category(bmi)
|
|
|
|
| 18 |
equipment_list = ", ".join(equipment) if equipment else "No Equipment"
|
| 19 |
|
| 20 |
+
# Strict instructions for Mistral-7B
|
| 21 |
+
prompt = f"""Create a professional 5-day workout plan for {name}.
|
|
|
|
|
|
|
|
|
|
| 22 |
User Profile:
|
|
|
|
| 23 |
- Gender: {gender}
|
|
|
|
|
|
|
| 24 |
- BMI: {bmi:.2f} ({bmi_status})
|
| 25 |
- Goal: {goal}
|
| 26 |
- Fitness Level: {fitness_level}
|
| 27 |
+
- Equipment: {equipment_list}
|
| 28 |
|
| 29 |
+
Requirements:
|
| 30 |
+
1. Provide a specific routine for Day 1, Day 2, Day 4, and Day 5.
|
| 31 |
+
2. Day 3 MUST be a Rest and Recovery day.
|
| 32 |
+
3. For every exercise, include the Name, Sets, Reps, and Rest Time.
|
| 33 |
+
4. Do not include any introductory text, start directly with Day 1.
|
| 34 |
+
5. Stop exactly after finishing Day 5."""
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
return prompt, bmi, bmi_status, status_color
|