saherPervaiz commited on
Commit
240a1f8
Β·
verified Β·
1 Parent(s): ca5bef8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -17
app.py CHANGED
@@ -65,25 +65,38 @@ def get_health_articles(query):
65
 
66
  # Streamlit app layout
67
  def main():
68
- st.title("Student Health Advisory Assistant")
69
- st.subheader("Analyze your well-being and get personalized advice")
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  # File upload
72
  uploaded_file = st.file_uploader("Upload your dataset (CSV)", type=["csv"])
73
  if uploaded_file:
74
  df = load_data(uploaded_file)
75
- st.write("Dataset preview:")
76
  st.dataframe(df.head())
77
 
78
  # User input for analysis
79
- st.header("Input Your Details")
80
- gender = st.selectbox("Gender", ["Male", "Female"])
81
- age = st.slider("Age", 18, 35, step=1)
82
- depression = st.slider("Depression Level (1-10)", 1, 10)
83
- anxiety = st.slider("Anxiety Level (1-10)", 1, 10)
84
- isolation = st.slider("Isolation Level (1-10)", 1, 10)
85
- future_insecurity = st.slider("Future Insecurity Level (1-10)", 1, 10)
86
- stress_relief_activities = st.slider("Stress Relief Activities Level (1-10)", 1, 10)
87
 
88
  # Data dictionary for advice
89
  user_data = {
@@ -97,19 +110,22 @@ def main():
97
  }
98
 
99
  # Provide advice based on user inputs
100
- if st.button("Get Observed Advice"):
101
- st.subheader("Health Advice Based on Observations")
102
  advice = provide_observed_advice(user_data)
103
- for i, tip in enumerate(advice, 1):
104
- st.write(f"{i}. {tip}")
 
 
 
105
 
106
  # Fetch related health articles based on user input
107
- st.subheader("Related Health Articles")
108
  query = "mental health anxiety depression isolation stress relief"
109
  articles = get_health_articles(query)
110
  if articles:
111
  for article in articles:
112
- st.write(f"- [{article['title']}]({article['url']})")
113
  else:
114
  st.write("No articles found. Please check your API key or internet connection.")
115
 
 
65
 
66
  # Streamlit app layout
67
  def main():
68
+ # Set a background color
69
+ st.markdown(
70
+ """
71
+ <style>
72
+ .stApp {
73
+ background-color: #F4F4F9;
74
+ }
75
+ </style>
76
+ """,
77
+ unsafe_allow_html=True
78
+ )
79
+
80
+ # Title and header
81
+ st.title("🌟 **Student Health Advisory Assistant** 🌟")
82
+ st.markdown("### **Analyze your well-being and get personalized advice**")
83
 
84
  # File upload
85
  uploaded_file = st.file_uploader("Upload your dataset (CSV)", type=["csv"])
86
  if uploaded_file:
87
  df = load_data(uploaded_file)
88
+ st.write("### Dataset Preview:")
89
  st.dataframe(df.head())
90
 
91
  # User input for analysis
92
+ st.markdown("### **Input Your Details**")
93
+ gender = st.selectbox("πŸ”Ή Gender", ["Male", "Female"], help="Select your gender.")
94
+ age = st.slider("πŸ”Ή Age", 18, 35, step=1)
95
+ depression = st.slider("πŸ”Ή Depression Level (1-10)", 1, 10)
96
+ anxiety = st.slider("πŸ”Ή Anxiety Level (1-10)", 1, 10)
97
+ isolation = st.slider("πŸ”Ή Isolation Level (1-10)", 1, 10)
98
+ future_insecurity = st.slider("πŸ”Ή Future Insecurity Level (1-10)", 1, 10)
99
+ stress_relief_activities = st.slider("πŸ”Ή Stress Relief Activities Level (1-10)", 1, 10)
100
 
101
  # Data dictionary for advice
102
  user_data = {
 
110
  }
111
 
112
  # Provide advice based on user inputs
113
+ if st.button("πŸ” Get Observed Advice", key="advice_btn"):
114
+ st.subheader("πŸ”” **Health Advice Based on Observations** πŸ””")
115
  advice = provide_observed_advice(user_data)
116
+ if advice:
117
+ for i, tip in enumerate(advice, 1):
118
+ st.write(f"πŸ“Œ {i}. {tip}")
119
+ else:
120
+ st.warning("No advice available based on your inputs.")
121
 
122
  # Fetch related health articles based on user input
123
+ st.subheader("πŸ“° **Related Health Articles** πŸ“°")
124
  query = "mental health anxiety depression isolation stress relief"
125
  articles = get_health_articles(query)
126
  if articles:
127
  for article in articles:
128
+ st.write(f"🌐 [{article['title']}]({article['url']})")
129
  else:
130
  st.write("No articles found. Please check your API key or internet connection.")
131