Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -90,33 +90,28 @@ def main():
|
|
90 |
st.write("### Dataset Preview:")
|
91 |
st.dataframe(df.head())
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
"
|
105 |
-
|
106 |
-
|
107 |
-
|
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(
|
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
|
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":
|