Spaces:
Runtime error
Runtime error
Update app.py
Browse filesfinal commit!!
app.py
CHANGED
@@ -208,7 +208,6 @@ def daily_log():
|
|
208 |
elif habit=='No':
|
209 |
st.write("Don't worry, you can catch up again tomorrow")
|
210 |
df.loc['Day7'] = ["\U0001F612"]
|
211 |
-
#st.bar_chart(df)
|
212 |
#Steps Calculator
|
213 |
st.markdown("""---""")
|
214 |
no_of_steps = st.text_input('Steps Walked Today', 0)
|
@@ -245,9 +244,7 @@ def daily_log():
|
|
245 |
if no_of_hrs>=0:
|
246 |
st.write("Well Done, Keep it up!! \u2705")
|
247 |
slp_df.loc['Day7'] = [no_of_hrs]
|
248 |
-
|
249 |
-
#slp_df = slp_df.copy(deep=False)
|
250 |
-
#st.dataframe(slp_df)
|
251 |
st.markdown("""---""")
|
252 |
st.markdown("""**Gratitude Journal**""")
|
253 |
st.markdown("""Use the below prompt and reflect on what you are grateful for today. We will provide you our insights \U0001f929 """)
|
@@ -289,7 +286,6 @@ def daily_log():
|
|
289 |
if trd_button:
|
290 |
st.session_state['trd_key'] = True
|
291 |
if st.session_state['trd_key']:
|
292 |
-
#if trd_button:
|
293 |
st.markdown("""**How your emotions varied in this week ?**""" +""" \U0001F612 \U0001F600""")
|
294 |
st.bar_chart(df)
|
295 |
st.markdown("""---""")
|
@@ -300,54 +296,47 @@ def daily_log():
|
|
300 |
st.line_chart(slp_df)
|
301 |
st.markdown("""---""")
|
302 |
check_box_prb = st.checkbox('I have completed my 7 days of tracking and I am ready to know your recomendation')
|
303 |
-
#st.dataframe(slp_df)
|
304 |
if 'cb_key' not in st.session_state:
|
305 |
st.session_state['cb_key'] = False
|
306 |
if check_box_prb:
|
307 |
st.session_state['cb_key'] = True
|
308 |
if st.session_state['cb_key']:
|
309 |
if check_box_prb:
|
310 |
-
|
311 |
if slp_df.shape[0] == 7:
|
312 |
-
|
313 |
st.write("That's Awesome! Keep the momentum going!")
|
314 |
st.markdown("""**Why don't you share what you are going through? This would help us to give a better recommendation**""")
|
315 |
classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')
|
316 |
sent = st.text_area('Brief your problem, we will suggest activities that could help you overcome stress',value="""As I am in college I am up all night all day getting only 5 hours of sleep daily. Eventually after some days I started facing some issues like mood swings and feeling lazy all the time , body ache, puffy eyes and ended up eating at night (one becomes snacky resulting at night) in weight gain.""")
|
317 |
prb_button = st.button(label='Submit',key='probsubmit')
|
318 |
-
|
319 |
-
#st.dataframe(slp_df)
|
320 |
if 'prbsol_key' not in st.session_state:
|
321 |
st.session_state['prbsol_key'] = False
|
322 |
if prb_button:
|
323 |
st.session_state['prbsol_key'] = True
|
324 |
if st.session_state['prbsol_key']:
|
325 |
|
326 |
-
|
327 |
-
#slp_df = slp_df.copy(deep=False)
|
328 |
-
candidate_labels = ["Sleep-disorder", "Work-stress", "Peer pressure"]
|
329 |
res = classifier(sent, candidate_labels)
|
330 |
problem = res['labels'][0]
|
331 |
-
st.write('We
|
332 |
st.markdown("""#### Not sure where to start? """+ """ \U0001f914 """+""" Here are our recommendations!! \U0001f917""")
|
333 |
#st.markdown("""###Not sure where to start?###"""+ """ \U0001f914 """+""" ###Here are our recommendations!!### \U0001f917""")
|
334 |
-
if problem == 'Sleep
|
335 |
st.write("Try this [Mediatation for Sleep on Headspace](https://www.headspace.com/meditation/sleep)")
|
336 |
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
|
337 |
-
elif problem == 'Work
|
338 |
st.write("Try this [Mediatation for Anxiety on Headspace](https://www.headspace.com/meditation/anxiety)")
|
339 |
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
|
340 |
-
elif problem == '
|
341 |
st.write("Try this [Calm Down Meditation](https://www.headspace.com/articles/how-to-calm-down)")
|
342 |
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
|
343 |
-
|
344 |
-
|
345 |
-
#st.write(type(res['labels']))
|
346 |
|
347 |
else:
|
348 |
warning = '<p style="font-family:sans-serif; color:Red; font-size: 12px;">Looks like you have not tracked your habits for a week. Instant solutions may not always work. Keep track for atleast 7 days</p>'
|
349 |
st.markdown(warning, unsafe_allow_html=True)
|
350 |
-
|
351 |
|
352 |
page_names_to_funcs = {
|
353 |
"Home": home_page,
|
@@ -356,20 +345,5 @@ page_names_to_funcs = {
|
|
356 |
"Monthly - Perceived Stress Scale": PSS_monthly
|
357 |
}
|
358 |
|
359 |
-
#st.set_page_config(page_title="Mental Well Being", layout="wide")
|
360 |
-
#st.markdown(
|
361 |
-
#"""
|
362 |
-
#<style>
|
363 |
-
# [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
|
364 |
-
# width: 250px;
|
365 |
-
# }
|
366 |
-
# [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
|
367 |
-
# width: 250px;
|
368 |
-
# margin-left: -250px;
|
369 |
-
# }
|
370 |
-
#
|
371 |
-
# """,
|
372 |
-
# unsafe_allow_html=True,
|
373 |
-
#)
|
374 |
demo_name = st.sidebar.selectbox("Choose one of our offerings", page_names_to_funcs.keys())
|
375 |
page_names_to_funcs[demo_name]()
|
208 |
elif habit=='No':
|
209 |
st.write("Don't worry, you can catch up again tomorrow")
|
210 |
df.loc['Day7'] = ["\U0001F612"]
|
|
|
211 |
#Steps Calculator
|
212 |
st.markdown("""---""")
|
213 |
no_of_steps = st.text_input('Steps Walked Today', 0)
|
244 |
if no_of_hrs>=0:
|
245 |
st.write("Well Done, Keep it up!! \u2705")
|
246 |
slp_df.loc['Day7'] = [no_of_hrs]
|
247 |
+
|
|
|
|
|
248 |
st.markdown("""---""")
|
249 |
st.markdown("""**Gratitude Journal**""")
|
250 |
st.markdown("""Use the below prompt and reflect on what you are grateful for today. We will provide you our insights \U0001f929 """)
|
286 |
if trd_button:
|
287 |
st.session_state['trd_key'] = True
|
288 |
if st.session_state['trd_key']:
|
|
|
289 |
st.markdown("""**How your emotions varied in this week ?**""" +""" \U0001F612 \U0001F600""")
|
290 |
st.bar_chart(df)
|
291 |
st.markdown("""---""")
|
296 |
st.line_chart(slp_df)
|
297 |
st.markdown("""---""")
|
298 |
check_box_prb = st.checkbox('I have completed my 7 days of tracking and I am ready to know your recomendation')
|
|
|
299 |
if 'cb_key' not in st.session_state:
|
300 |
st.session_state['cb_key'] = False
|
301 |
if check_box_prb:
|
302 |
st.session_state['cb_key'] = True
|
303 |
if st.session_state['cb_key']:
|
304 |
if check_box_prb:
|
305 |
+
|
306 |
if slp_df.shape[0] == 7:
|
307 |
+
|
308 |
st.write("That's Awesome! Keep the momentum going!")
|
309 |
st.markdown("""**Why don't you share what you are going through? This would help us to give a better recommendation**""")
|
310 |
classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')
|
311 |
sent = st.text_area('Brief your problem, we will suggest activities that could help you overcome stress',value="""As I am in college I am up all night all day getting only 5 hours of sleep daily. Eventually after some days I started facing some issues like mood swings and feeling lazy all the time , body ache, puffy eyes and ended up eating at night (one becomes snacky resulting at night) in weight gain.""")
|
312 |
prb_button = st.button(label='Submit',key='probsubmit')
|
313 |
+
|
|
|
314 |
if 'prbsol_key' not in st.session_state:
|
315 |
st.session_state['prbsol_key'] = False
|
316 |
if prb_button:
|
317 |
st.session_state['prbsol_key'] = True
|
318 |
if st.session_state['prbsol_key']:
|
319 |
|
320 |
+
candidate_labels = ["Sleep", "Work", "Relationships"]
|
|
|
|
|
321 |
res = classifier(sent, candidate_labels)
|
322 |
problem = res['labels'][0]
|
323 |
+
st.write('We notice that you may have problems with ',problem )
|
324 |
st.markdown("""#### Not sure where to start? """+ """ \U0001f914 """+""" Here are our recommendations!! \U0001f917""")
|
325 |
#st.markdown("""###Not sure where to start?###"""+ """ \U0001f914 """+""" ###Here are our recommendations!!### \U0001f917""")
|
326 |
+
if problem == 'Sleep':
|
327 |
st.write("Try this [Mediatation for Sleep on Headspace](https://www.headspace.com/meditation/sleep)")
|
328 |
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
|
329 |
+
elif problem == 'Work':
|
330 |
st.write("Try this [Mediatation for Anxiety on Headspace](https://www.headspace.com/meditation/anxiety)")
|
331 |
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
|
332 |
+
elif problem == 'Relationships':
|
333 |
st.write("Try this [Calm Down Meditation](https://www.headspace.com/articles/how-to-calm-down)")
|
334 |
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
|
|
|
|
|
|
|
335 |
|
336 |
else:
|
337 |
warning = '<p style="font-family:sans-serif; color:Red; font-size: 12px;">Looks like you have not tracked your habits for a week. Instant solutions may not always work. Keep track for atleast 7 days</p>'
|
338 |
st.markdown(warning, unsafe_allow_html=True)
|
339 |
+
|
340 |
|
341 |
page_names_to_funcs = {
|
342 |
"Home": home_page,
|
345 |
"Monthly - Perceived Stress Scale": PSS_monthly
|
346 |
}
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
demo_name = st.sidebar.selectbox("Choose one of our offerings", page_names_to_funcs.keys())
|
349 |
page_names_to_funcs[demo_name]()
|