Sudheer commited on
Commit
77588af
1 Parent(s): 10a912b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -31
app.py CHANGED
@@ -292,42 +292,53 @@ def daily_log():
292
  st.line_chart(slp_df)
293
  st.markdown("""---""")
294
  check_box_prb = st.checkbox('I have completed my 7 days of tracking and I am ready to know your recomendation')
295
- #st.dataframe(slp_df)
 
 
296
  if check_box_prb:
297
- slp_df = slp_df.copy(deep=False)
298
- #if slp_df.shape[0] == 7:
299
- #st.write(slp_df.shape[0])
300
- st.write("That's Awesome! Keep the momentum going!")
301
- st.markdown("""**Why don't you share what you are going through? This would help us to give a better recommendation**""")
302
- classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')
303
- 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.""")
304
- prb_button = st.button(label='Submit',key='probsubmit')
305
  #slp_df = slp_df.copy(deep=False)
306
- #st.dataframe(slp_df)
307
- if prb_button:
308
- #st.dataframe(slp_df)
309
- #slp_df = slp_df.copy(deep=False)
310
- candidate_labels = ["Sleep-disorder", "Work-stress", "Peer pressure"]
311
- res = classifier(sent, candidate_labels)
312
- problem = res['labels'][0]
313
- st.write('We feel working on ',problem ,' could improve your overall well-being')
314
- st.markdown("""###Not sure where to start?###"""+ """ \U0001f914 """+""" ###Here are our recommendations!!### \U0001f917""")
315
- if problem == 'Sleep-disorder':
316
- st.write("Try this [Mediatation for Sleep on Headspace](https://www.headspace.com/meditation/sleep)")
317
- st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
318
- elif problem == 'Work-stress':
319
- st.write("Try this [Mediatation for Anxiety on Headspace](https://www.headspace.com/meditation/anxiety)")
320
- st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
321
- elif problem == 'Peer pressure':
322
- st.write("Try this [Calm Down Meditation](https://www.headspace.com/articles/how-to-calm-down)")
323
- st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
 
326
  #st.write(type(res['labels']))
327
- #else:
328
- # warning = '<p style="font-family:sans-serif; color:Red; font-size: 42px;">Looks like you have not tracked your habits for a week. Instant solutions may not always work. Keep track for atleast 7 days</p>'
329
- #st.markdown(warning, unsafe_allow_html=True)
330
- #st.write('Looks like you have not tracked your habits for a week. Instant solutions may not always work. Keep track for atleast 7 days')
 
331
 
332
  page_names_to_funcs = {
333
  "Home": home_page,
 
292
  st.line_chart(slp_df)
293
  st.markdown("""---""")
294
  check_box_prb = st.checkbox('I have completed my 7 days of tracking and I am ready to know your recomendation')
295
+ #st.dataframe(slp_df)
296
+ if 'cb_key' not in st.session_state:
297
+ st.session_state['cb_key'] = False
298
  if check_box_prb:
299
+ st.session_state['cb_key'] = True
300
+ if st.session_state['cb_key']:
301
+ if check_box_prb:
 
 
 
 
 
302
  #slp_df = slp_df.copy(deep=False)
303
+ if slp_df.shape[0] == 7:
304
+ #st.write(slp_df.shape[0])
305
+ st.write("That's Awesome! Keep the momentum going!")
306
+ st.markdown("""**Why don't you share what you are going through? This would help us to give a better recommendation**""")
307
+ classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')
308
+ 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.""")
309
+ prb_button = st.button(label='Submit',key='probsubmit')
310
+ #slp_df = slp_df.copy(deep=False)
311
+ #st.dataframe(slp_df)
312
+ if 'prbsol_key' not in st.session_state:
313
+ st.session_state['prbsol_key'] = False
314
+ if prb_button:
315
+ st.session_state['prbsol_key'] = True
316
+ if st.session_state['prbsol_key']:
317
+
318
+ #st.dataframe(slp_df)
319
+ #slp_df = slp_df.copy(deep=False)
320
+ candidate_labels = ["Sleep-disorder", "Work-stress", "Peer pressure"]
321
+ res = classifier(sent, candidate_labels)
322
+ problem = res['labels'][0]
323
+ st.write('We feel working on ',problem ,' could improve your overall well-being')
324
+ st.markdown("""###Not sure where to start?###"""+ """ \U0001f914 """+""" ###Here are our recommendations!!### \U0001f917""")
325
+ if problem == 'Sleep-disorder':
326
+ st.write("Try this [Mediatation for Sleep on Headspace](https://www.headspace.com/meditation/sleep)")
327
+ st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
328
+ elif problem == 'Work-stress':
329
+ st.write("Try this [Mediatation for Anxiety on Headspace](https://www.headspace.com/meditation/anxiety)")
330
+ st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
331
+ elif problem == 'Peer pressure':
332
+ st.write("Try this [Calm Down Meditation](https://www.headspace.com/articles/how-to-calm-down)")
333
+ st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
334
 
335
 
336
  #st.write(type(res['labels']))
337
+
338
+ else:
339
+ warning = '<p style="font-family:sans-serif; color:Red; font-size: 42px;">Looks like you have not tracked your habits for a week. Instant solutions may not always work. Keep track for atleast 7 days</p>'
340
+ st.markdown(warning, unsafe_allow_html=True)
341
+ st.write('Looks like you have not tracked your habits for a week. Instant solutions may not always work. Keep track for atleast 7 days')
342
 
343
  page_names_to_funcs = {
344
  "Home": home_page,