Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,6 @@ def format_plan(response):
|
|
| 52 |
# Ayurvedic prompt template
|
| 53 |
ayurveda_prompt_template = """
|
| 54 |
You are a health expert specialized in both modern medicine and Ayurveda. Generate a personalized weekly diet and exercise plan for {name}, a {age}-year-old {gender} with a BMI of {bmi} ({health_status}).
|
| 55 |
-
|
| 56 |
Fitness Goal: {fitness_goal}.
|
| 57 |
Daily Calorie Requirement: {daily_calories} kcal.
|
| 58 |
Dietary Preference: {dietary_preference}.
|
|
@@ -60,7 +59,6 @@ Food Allergies: {food_allergies}.
|
|
| 60 |
Local Cuisine: {local_cuisine}.
|
| 61 |
Month: {month}.
|
| 62 |
Ayurvedic Consideration: True
|
| 63 |
-
|
| 64 |
Plan should include:
|
| 65 |
1. A daily diet plan with meal timings, calorie details, and meal alternatives.
|
| 66 |
2. Exercise routines based on goals, incorporating cardio, strength, and flexibility.
|
|
@@ -80,9 +78,7 @@ Plan should include:
|
|
| 80 |
- Seasonal herbs and spices for balance.
|
| 81 |
- Daily routines (Dinacharya) for optimal health.
|
| 82 |
- Natural remedies complementing modern medicine.
|
| 83 |
-
|
| 84 |
Provide a detailed plan for each weekday: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
|
| 85 |
-
|
| 86 |
Return output as:
|
| 87 |
Day: {{weekday}}
|
| 88 |
- Breakfast: Time, Description, Calories, Ayurvedic Properties
|
|
@@ -99,14 +95,12 @@ Day: {{weekday}}
|
|
| 99 |
# Regular prompt template
|
| 100 |
regular_prompt_template = """
|
| 101 |
You are a health expert. Generate a personalized weekly diet and exercise plan for {name}, a {age}-year-old {gender} with a BMI of {bmi} ({health_status}).
|
| 102 |
-
|
| 103 |
Fitness Goal: {fitness_goal}.
|
| 104 |
Daily Calorie Requirement: {daily_calories} kcal.
|
| 105 |
Dietary Preference: {dietary_preference}.
|
| 106 |
Food Allergies: {food_allergies}.
|
| 107 |
Local Cuisine: {local_cuisine}.
|
| 108 |
Month: {month}.
|
| 109 |
-
|
| 110 |
Plan should include:
|
| 111 |
1. A daily diet plan with meal timings, calorie details, and meal alternatives.
|
| 112 |
2. Exercise routines based on goals, incorporating cardio, strength, and flexibility.
|
|
@@ -120,9 +114,7 @@ Plan should include:
|
|
| 120 |
- Multi-restaurant meal aggregation for complete diet fulfillment.
|
| 121 |
- Location-based meal recommendations.
|
| 122 |
- Customizable meal delivery schedules.
|
| 123 |
-
|
| 124 |
Provide a detailed plan for each weekday: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
|
| 125 |
-
|
| 126 |
Return output as:
|
| 127 |
Day: {{weekday}}
|
| 128 |
- Breakfast: Time, Description, Calories
|
|
@@ -203,10 +195,8 @@ if st.button("Generate Plan"):
|
|
| 203 |
selected_prompt = ayurveda_prompt_template if include_ayurveda else regular_prompt_template
|
| 204 |
plan = generate_plan_with_prompt(metrics, selected_prompt)
|
| 205 |
formatted_plan = format_plan(plan)
|
| 206 |
-
|
| 207 |
plan_title = "Integrated Ayurvedic & Modern Diet and Exercise Plan" if include_ayurveda else "Diet and Exercise Plan"
|
| 208 |
st.header(f"Generated {plan_title} for {month}")
|
| 209 |
st.markdown(formatted_plan)
|
| 210 |
except Exception as e:
|
| 211 |
st.error(f"Error generating the plan: {e}")
|
| 212 |
-
|
|
|
|
| 52 |
# Ayurvedic prompt template
|
| 53 |
ayurveda_prompt_template = """
|
| 54 |
You are a health expert specialized in both modern medicine and Ayurveda. Generate a personalized weekly diet and exercise plan for {name}, a {age}-year-old {gender} with a BMI of {bmi} ({health_status}).
|
|
|
|
| 55 |
Fitness Goal: {fitness_goal}.
|
| 56 |
Daily Calorie Requirement: {daily_calories} kcal.
|
| 57 |
Dietary Preference: {dietary_preference}.
|
|
|
|
| 59 |
Local Cuisine: {local_cuisine}.
|
| 60 |
Month: {month}.
|
| 61 |
Ayurvedic Consideration: True
|
|
|
|
| 62 |
Plan should include:
|
| 63 |
1. A daily diet plan with meal timings, calorie details, and meal alternatives.
|
| 64 |
2. Exercise routines based on goals, incorporating cardio, strength, and flexibility.
|
|
|
|
| 78 |
- Seasonal herbs and spices for balance.
|
| 79 |
- Daily routines (Dinacharya) for optimal health.
|
| 80 |
- Natural remedies complementing modern medicine.
|
|
|
|
| 81 |
Provide a detailed plan for each weekday: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
|
|
|
|
| 82 |
Return output as:
|
| 83 |
Day: {{weekday}}
|
| 84 |
- Breakfast: Time, Description, Calories, Ayurvedic Properties
|
|
|
|
| 95 |
# Regular prompt template
|
| 96 |
regular_prompt_template = """
|
| 97 |
You are a health expert. Generate a personalized weekly diet and exercise plan for {name}, a {age}-year-old {gender} with a BMI of {bmi} ({health_status}).
|
|
|
|
| 98 |
Fitness Goal: {fitness_goal}.
|
| 99 |
Daily Calorie Requirement: {daily_calories} kcal.
|
| 100 |
Dietary Preference: {dietary_preference}.
|
| 101 |
Food Allergies: {food_allergies}.
|
| 102 |
Local Cuisine: {local_cuisine}.
|
| 103 |
Month: {month}.
|
|
|
|
| 104 |
Plan should include:
|
| 105 |
1. A daily diet plan with meal timings, calorie details, and meal alternatives.
|
| 106 |
2. Exercise routines based on goals, incorporating cardio, strength, and flexibility.
|
|
|
|
| 114 |
- Multi-restaurant meal aggregation for complete diet fulfillment.
|
| 115 |
- Location-based meal recommendations.
|
| 116 |
- Customizable meal delivery schedules.
|
|
|
|
| 117 |
Provide a detailed plan for each weekday: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
|
|
|
|
| 118 |
Return output as:
|
| 119 |
Day: {{weekday}}
|
| 120 |
- Breakfast: Time, Description, Calories
|
|
|
|
| 195 |
selected_prompt = ayurveda_prompt_template if include_ayurveda else regular_prompt_template
|
| 196 |
plan = generate_plan_with_prompt(metrics, selected_prompt)
|
| 197 |
formatted_plan = format_plan(plan)
|
|
|
|
| 198 |
plan_title = "Integrated Ayurvedic & Modern Diet and Exercise Plan" if include_ayurveda else "Diet and Exercise Plan"
|
| 199 |
st.header(f"Generated {plan_title} for {month}")
|
| 200 |
st.markdown(formatted_plan)
|
| 201 |
except Exception as e:
|
| 202 |
st.error(f"Error generating the plan: {e}")
|
|
|