DrishtiSharma commited on
Commit
1cbb7b8
Β·
verified Β·
1 Parent(s): d62328a

Update mylab/personalized_chat_w_viz.py

Browse files
Files changed (1) hide show
  1. mylab/personalized_chat_w_viz.py +14 -6
mylab/personalized_chat_w_viz.py CHANGED
@@ -152,16 +152,24 @@ with gr.Blocks() as demo:
152
  )
153
  chart_path = visualize_bmi_and_calories(bmi, calories)
154
 
155
- # Append metrics to response
156
  personalized_metrics = (
157
  f"Based on your metrics:\n"
158
  f"- BMI: {bmi:.2f} ({status})\n"
159
  f"- Daily Caloric Needs: {calories:.2f} kcal\n"
160
- f"Visualized metrics are displayed alongside."
161
  )
162
-
163
- response = run_graph(f"{message}\n\n{personalized_metrics}", history, user_details)
164
- history.append((f"{user_details['name']}", message))
 
 
 
 
 
 
 
 
165
  history.append(("FIT.AI", response))
166
  return history, chart_path
167
 
@@ -183,4 +191,4 @@ with gr.Blocks() as demo:
183
  outputs=[bmi_output, calorie_output, bmi_chart]
184
  )
185
 
186
- demo.launch(share=True)
 
152
  )
153
  chart_path = visualize_bmi_and_calories(bmi, calories)
154
 
155
+ # Append metrics to response with actionable advice
156
  personalized_metrics = (
157
  f"Based on your metrics:\n"
158
  f"- BMI: {bmi:.2f} ({status})\n"
159
  f"- Daily Caloric Needs: {calories:.2f} kcal\n"
160
+ f"\nAdvice: "
161
  )
162
+ if status == "underweight":
163
+ personalized_metrics += "Your BMI indicates you are underweight. Focus on consuming more calories from nutrient-dense foods, including lean proteins, healthy fats, and whole grains. Consider strength training exercises to build muscle mass."
164
+ elif status == "normal weight":
165
+ personalized_metrics += "Your BMI is in the normal range. Maintain your weight by balancing calorie intake with regular physical activity. Incorporate a mix of cardio and strength training for overall fitness."
166
+ elif status == "overweight":
167
+ personalized_metrics += "Your BMI indicates you are overweight. Aim for a calorie deficit by reducing portion sizes and increasing physical activity. Focus on a diet rich in vegetables, lean protein, and healthy fats."
168
+ else:
169
+ personalized_metrics += "Your BMI indicates you are obese. Consult a healthcare provider for a personalized weight loss plan. Start with small, sustainable changes, such as reducing sugary foods and increasing daily physical activity."
170
+
171
+ response = personalized_metrics
172
+ history.append((f"User", message))
173
  history.append(("FIT.AI", response))
174
  return history, chart_path
175
 
 
191
  outputs=[bmi_output, calorie_output, bmi_chart]
192
  )
193
 
194
+ demo.launch(share=True)