saherPervaiz commited on
Commit
879d7df
Β·
verified Β·
1 Parent(s): 0d4cbaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -22
app.py CHANGED
@@ -90,33 +90,28 @@ def main():
90
  st.write("### Dataset Preview:")
91
  st.dataframe(df.head())
92
 
93
- st.markdown("### Input Your Details")
94
- gender = st.selectbox("πŸ”Ή Gender", ["Male", "Female"])
95
- age = st.slider("πŸ”Ή Age", 18, 35, step=1)
96
- depression = st.slider("πŸ”Ή Depression Level (1-10)", 1, 10)
97
- anxiety = st.slider("πŸ”Ή Anxiety Level (1-10)", 1, 10)
98
- isolation = st.slider("πŸ”Ή Isolation Level (1-10)", 1, 10)
99
- future_insecurity = st.slider("πŸ”Ή Future Insecurity Level (1-10)", 1, 10)
100
- stress_relief_activities = st.slider("πŸ”Ή Stress Relief Activities Level (1-10)", 1, 10)
101
-
102
- user_data = {
103
- "gender": gender,
104
- "age": age,
105
- "depression": depression,
106
- "anxiety": anxiety,
107
- "isolation": isolation,
108
- "future_insecurity": future_insecurity,
109
- "stress_relief_activities": stress_relief_activities,
110
- }
111
-
112
- if st.button("Get Observed Advice"):
113
  st.subheader("πŸ”” Health Advice Based on Observations")
114
- advice = provide_observed_advice(user_data)
115
  if advice:
116
  for i, tip in enumerate(advice, 1):
117
  st.write(f"πŸ“Œ **{i}.** {tip}")
118
  else:
119
- st.warning("No specific advice available based on your inputs.")
120
 
121
  # Health Articles
122
  elif option == "Health Articles":
 
90
  st.write("### Dataset Preview:")
91
  st.dataframe(df.head())
92
 
93
+ st.markdown("### Select a Row for Analysis")
94
+ selected_row = st.selectbox(
95
+ "Select a row (based on index) to analyze:",
96
+ options=df.index,
97
+ format_func=lambda x: f"Row {x} - Age: {df.loc[x, 'age']}, Gender: {df.loc[x, 'gender']}",
98
+ )
99
+
100
+ # Extract data for the selected row
101
+ row_data = df.loc[selected_row].to_dict()
102
+
103
+ # Show extracted details
104
+ st.write("### Selected User Details:")
105
+ st.json(row_data)
106
+
107
+ # Generate advice
 
 
 
 
 
108
  st.subheader("πŸ”” Health Advice Based on Observations")
109
+ advice = provide_observed_advice(row_data)
110
  if advice:
111
  for i, tip in enumerate(advice, 1):
112
  st.write(f"πŸ“Œ **{i}.** {tip}")
113
  else:
114
+ st.warning("No specific advice available based on this user's data.")
115
 
116
  # Health Articles
117
  elif option == "Health Articles":