Abs6187 commited on
Commit
341537a
·
verified ·
1 Parent(s): c7f637b

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +82 -5
  2. team_info.py +22 -0
app.py CHANGED
@@ -1,8 +1,15 @@
1
-
2
  import streamlit as st
3
  from dotenv import load_dotenv
4
  from langchain_groq import ChatGroq
5
  import os
 
 
 
 
 
 
 
 
6
 
7
  # Load environment variables
8
  load_dotenv()
@@ -42,8 +49,55 @@ def format_plan(response):
42
  except Exception as e:
43
  return f"Error formatting plan: {e}"
44
 
45
- # Prompt template
46
- prompt_template = """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  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}).
48
 
49
  Fitness Goal: {fitness_goal}.
@@ -84,6 +138,22 @@ Day: {{weekday}}
84
  # Streamlit app
85
  st.title("AI-Based Personalized Weekly Diet and Exercise Planner")
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  # Input fields
88
  st.header("Enter Your Details")
89
  name = st.text_input("Name")
@@ -97,6 +167,9 @@ food_allergies = st.text_input("Food Allergies (if any)")
97
  local_cuisine = st.text_input("Preferred Local Cuisine (e.g., Indian, Italian, Chinese)")
98
  month = st.selectbox("Select Month", options=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"])
99
 
 
 
 
100
  bmi = round(weight / (height / 100) ** 2, 2)
101
  health_status = "Underweight" if bmi < 18.5 else "Normal weight" if bmi <= 24.9 else "Overweight"
102
  daily_calories = calculate_calorie_requirements(age, gender, weight, height, fitness_goal)
@@ -124,9 +197,13 @@ metrics = {
124
  if st.button("Generate Plan"):
125
  with st.spinner("Generating your plan..."):
126
  try:
127
- plan = generate_plan_with_prompt(metrics, prompt_template)
 
 
128
  formatted_plan = format_plan(plan)
129
- st.header(f"Generated Diet and Exercise Plan for {month}")
 
 
130
  st.markdown(formatted_plan)
131
  except Exception as e:
132
  st.error(f"Error generating the plan: {e}")
 
 
1
  import streamlit as st
2
  from dotenv import load_dotenv
3
  from langchain_groq import ChatGroq
4
  import os
5
+ import importlib.util
6
+
7
+ # Check if team_info module exists and import it
8
+ try:
9
+ import team_info
10
+ has_team_info = True
11
+ except ImportError:
12
+ has_team_info = False
13
 
14
  # Load environment variables
15
  load_dotenv()
 
49
  except Exception as e:
50
  return f"Error formatting plan: {e}"
51
 
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}.
59
+ 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.
67
+ 3. Dynamic plan adjustments based on month and local cuisine preferences.
68
+ 4. Wearable integration for tracking steps, heart rate, and calorie burn.
69
+ 5. Progress monitoring for daily calorie burn and weight tracking.
70
+ 6. **Food Delivery Integration**:
71
+ - Meal suggestions based on diet plans.
72
+ - Integration with food delivery platforms (Uber Eats, DoorDash).
73
+ - Searching menu items that fit calorie and dietary preferences.
74
+ - Multi-restaurant meal aggregation for complete diet fulfillment.
75
+ - Location-based meal recommendations.
76
+ - Customizable meal delivery schedules.
77
+ 7. **Ayurvedic Elements**:
78
+ - Dosha assessment based on provided metrics.
79
+ - Ayurvedic dietary recommendations aligned with your dosha type.
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
89
+ - Lunch: Time, Description, Calories, Ayurvedic Properties
90
+ - Snacks: Time, Description, Calories, Ayurvedic Properties
91
+ - Dinner: Time, Description, Calories, Ayurvedic Properties
92
+ - Exercise: Description, Duration, Dosha Benefits
93
+ - Wearable Tracking: Steps, Heart Rate, Calories Burned
94
+ - Progress Monitoring: Daily calorie intake vs. burn.
95
+ - Food Delivery: Suggested meal items and delivery options.
96
+ - Ayurvedic Tips: Daily wellness practices based on dosha.
97
+ """
98
+
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}.
 
138
  # Streamlit app
139
  st.title("AI-Based Personalized Weekly Diet and Exercise Planner")
140
 
141
+ # Add sidebar with team information
142
+ with st.sidebar:
143
+ st.header("About this Project")
144
+ st.write("Integration of Ayurveda and modern medical science for comprehensive wellness insights")
145
+
146
+ if has_team_info:
147
+ st.subheader("Team Members")
148
+ st.markdown("- Aditi Soni [LinkedIn](https://www.linkedin.com/in/aditi-soni-259813285/)")
149
+ st.markdown("- Bhumika Patel [LinkedIn](https://www.linkedin.com/in/bhumika-patel-ml/)")
150
+ st.markdown("- Aditi Lakhera [LinkedIn](https://www.linkedin.com/in/aditi-lakhera-b628802bb/)")
151
+
152
+ st.subheader("Project Links")
153
+ st.markdown("[GitHub Repository](https://github.com/Abs6187/AI_Health_v2)")
154
+ st.markdown("[Presentation](https://github.com/Abs6187/AI_Health_v2/blob/main/HackGirl_PPT_HackSRIT.pptx)")
155
+ st.markdown("[Hackathon](https://unstop.com/hackathons/hacksrit-shri-ram-group-of-institutions-jabalpur-1471613)")
156
+
157
  # Input fields
158
  st.header("Enter Your Details")
159
  name = st.text_input("Name")
 
167
  local_cuisine = st.text_input("Preferred Local Cuisine (e.g., Indian, Italian, Chinese)")
168
  month = st.selectbox("Select Month", options=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"])
169
 
170
+ # New option for Ayurvedic integration
171
+ include_ayurveda = st.checkbox("Include Ayurvedic wellness insights", value=True)
172
+
173
  bmi = round(weight / (height / 100) ** 2, 2)
174
  health_status = "Underweight" if bmi < 18.5 else "Normal weight" if bmi <= 24.9 else "Overweight"
175
  daily_calories = calculate_calorie_requirements(age, gender, weight, height, fitness_goal)
 
197
  if st.button("Generate Plan"):
198
  with st.spinner("Generating your plan..."):
199
  try:
200
+ # Choose the appropriate prompt based on the Ayurveda option
201
+ selected_prompt = ayurveda_prompt_template if include_ayurveda else regular_prompt_template
202
+ plan = generate_plan_with_prompt(metrics, selected_prompt)
203
  formatted_plan = format_plan(plan)
204
+
205
+ plan_title = "Integrated Ayurvedic & Modern Diet and Exercise Plan" if include_ayurveda else "Diet and Exercise Plan"
206
+ st.header(f"Generated {plan_title} for {month}")
207
  st.markdown(formatted_plan)
208
  except Exception as e:
209
  st.error(f"Error generating the plan: {e}")
team_info.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Team Information and Project Details for AI Health Advisor
3
+
4
+ Integration of Ayurveda and modern medical science for comprehensive wellness insights.
5
+
6
+ Team Members:
7
+ - Aditi Soni @https://www.linkedin.com/in/aditi-soni-259813285/
8
+ - Bhumika Patel @https://www.linkedin.com/in/bhumika-patel-ml/
9
+ - Aditi Lakhera @https://www.linkedin.com/in/aditi-lakhera-b628802bb/
10
+
11
+ Project Links:
12
+ - Github Repository: https://github.com/Abs6187/AI_Health_v2
13
+ - Presentation: https://github.com/Abs6187/AI_Health_v2/blob/main/HackGirl_PPT_HackSRIT.pptx
14
+ - Hackathon: https://unstop.com/hackathons/hacksrit-shri-ram-group-of-institutions-jabalpur-1471613
15
+
16
+ Future Integration Plans:
17
+ - Enhanced Ayurvedic insights based on user health metrics
18
+ - Personalized doshas assessment and recommendations
19
+ - Integration of seasonal herbs and spices based on Ayurvedic principles
20
+ - Modern medical validations for traditional recommendations
21
+ - Holistic wellness tracking with combined approaches
22
+ """