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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -171,7 +171,11 @@ def daily_log():
171
  with st.form(key='Sentiment'):
172
  prompt = st.text_area('Thought Journal:',value="Hackathon was the best part of today and collaborating with colleagues is icing on the cake. It was challenging though.")
173
  submit_button = st.form_submit_button(label='Submit')
 
 
174
  if submit_button:
 
 
175
  out = sentiment_task(prompt)
176
  if out[0]['label'] =='Positive':
177
  score = out[0]['score']
@@ -184,7 +188,12 @@ def daily_log():
184
  button = st.button('Track',key='hbt_button')
185
  df = pd.DataFrame(list(zip(days, history)), columns =['Days','Emotions'])
186
  df = df.set_index('Days')
 
 
187
  if button:
 
 
 
188
  if habit=='Yes':
189
  st.write("Well Done, Keep it up!! \u2705")
190
  df.loc['Day7'] = ["\U0001F600"]
@@ -201,7 +210,12 @@ def daily_log():
201
  stp_button = st.button('Track',key='stp_button')
202
  stp_df = pd.DataFrame(list(zip(stp_days, stp_history)), columns =['Days','Steps'])
203
  stp_df = stp_df.set_index('Days')
 
 
204
  if stp_button:
 
 
 
205
  if no_of_steps>=0:
206
  st.write("Well Done, Keep it up!! \u2705")
207
  stp_df.loc['Day7'] = [no_of_steps]
@@ -214,7 +228,12 @@ def daily_log():
214
  slp_button = st.button('Track',key='slp_button')
215
  slp_df = pd.DataFrame(list(zip(hrs_days, hrs_history)), columns =['Days','Hours slept'])
216
  slp_df = slp_df.set_index('Days')
 
 
217
  if slp_button:
 
 
 
218
  if no_of_hrs>=0:
219
  st.write("Well Done, Keep it up!! \u2705")
220
  slp_df.loc['Day7'] = [no_of_hrs]
@@ -226,7 +245,12 @@ def daily_log():
226
  st.markdown("""Use the below prompt and reflect on what you are grateful for today. We will provide you our insights \U0001f929 """)
227
  gratitude = st.text_area('I am grateful for ....',value='the wonderful family I am gifted with. They are always supportive and encourage to achieve my goals.')
228
  grt_button = st.button('Get me things that I love the most',key='grt_button')
 
 
229
  if grt_button:
 
 
 
230
  #Synthetic data
231
  grt_text = 'Family Trip Friends Books College Movies friendship friendship Food Gatherings School Rain Nature Discipline Compassionate laugh, joy , excellent, relaxing, food, cakes, chocolates, sweets, festival, Family Family Family hilarious, weekends, Movies friendship, love rainbow, comedy affection vacation beach dance sports attractive optimistic moonlight, bonus ' + gratitude
232
 
@@ -251,8 +275,13 @@ def daily_log():
251
  st.markdown("""\n""")
252
  st.markdown("""---""")
253
  st.markdown("""**Want to know how you are doing in this week ?**""" +""" \U0001f4c8""")
254
- trd_button = st.button('Display Trends',key='trds_button')
 
 
255
  if trd_button:
 
 
 
256
  st.markdown("""**How your emotions varied in this week ?**""" +""" \U0001F612 \U0001F600""")
257
  st.bar_chart(df)
258
  st.markdown("""---""")
 
171
  with st.form(key='Sentiment'):
172
  prompt = st.text_area('Thought Journal:',value="Hackathon was the best part of today and collaborating with colleagues is icing on the cake. It was challenging though.")
173
  submit_button = st.form_submit_button(label='Submit')
174
+ if 'thought_key' not in st.session_state:
175
+ st.session_state['thought_key'] = False
176
  if submit_button:
177
+ st.session_state['thought_key'] = True
178
+ if st.session_state['thought_key']:
179
  out = sentiment_task(prompt)
180
  if out[0]['label'] =='Positive':
181
  score = out[0]['score']
 
188
  button = st.button('Track',key='hbt_button')
189
  df = pd.DataFrame(list(zip(days, history)), columns =['Days','Emotions'])
190
  df = df.set_index('Days')
191
+ if 'habit_key' not in st.session_state:
192
+ st.session_state['habit_key'] = False
193
  if button:
194
+ st.session_state['habit_key'] = True
195
+ if st.session_state['habit_key']:
196
+ #if button:
197
  if habit=='Yes':
198
  st.write("Well Done, Keep it up!! \u2705")
199
  df.loc['Day7'] = ["\U0001F600"]
 
210
  stp_button = st.button('Track',key='stp_button')
211
  stp_df = pd.DataFrame(list(zip(stp_days, stp_history)), columns =['Days','Steps'])
212
  stp_df = stp_df.set_index('Days')
213
+ if 'stp_key' not in st.session_state:
214
+ st.session_state['stp_key'] = False
215
  if stp_button:
216
+ st.session_state['stp_key'] = True
217
+ if st.session_state['stp_key']:
218
+ #if stp_button:
219
  if no_of_steps>=0:
220
  st.write("Well Done, Keep it up!! \u2705")
221
  stp_df.loc['Day7'] = [no_of_steps]
 
228
  slp_button = st.button('Track',key='slp_button')
229
  slp_df = pd.DataFrame(list(zip(hrs_days, hrs_history)), columns =['Days','Hours slept'])
230
  slp_df = slp_df.set_index('Days')
231
+ if 'slp_key' not in st.session_state:
232
+ st.session_state['slp_key'] = False
233
  if slp_button:
234
+ st.session_state['slp_key'] = True
235
+ if st.session_state['slp_key']:
236
+ #if slp_button:
237
  if no_of_hrs>=0:
238
  st.write("Well Done, Keep it up!! \u2705")
239
  slp_df.loc['Day7'] = [no_of_hrs]
 
245
  st.markdown("""Use the below prompt and reflect on what you are grateful for today. We will provide you our insights \U0001f929 """)
246
  gratitude = st.text_area('I am grateful for ....',value='the wonderful family I am gifted with. They are always supportive and encourage to achieve my goals.')
247
  grt_button = st.button('Get me things that I love the most',key='grt_button')
248
+ if 'grt_key' not in st.session_state:
249
+ st.session_state['grt_key'] = False
250
  if grt_button:
251
+ st.session_state['grt_key'] = True
252
+ if st.session_state['grt_key']:
253
+ #if grt_button:
254
  #Synthetic data
255
  grt_text = 'Family Trip Friends Books College Movies friendship friendship Food Gatherings School Rain Nature Discipline Compassionate laugh, joy , excellent, relaxing, food, cakes, chocolates, sweets, festival, Family Family Family hilarious, weekends, Movies friendship, love rainbow, comedy affection vacation beach dance sports attractive optimistic moonlight, bonus ' + gratitude
256
 
 
275
  st.markdown("""\n""")
276
  st.markdown("""---""")
277
  st.markdown("""**Want to know how you are doing in this week ?**""" +""" \U0001f4c8""")
278
+ trd_button = st.button('Display Trends',key='trds_button')
279
+ if 'trd_key' not in st.session_state:
280
+ st.session_state['trd_key'] = False
281
  if trd_button:
282
+ st.session_state['trd_key'] = True
283
+ if st.session_state['trd_key']:
284
+ #if trd_button:
285
  st.markdown("""**How your emotions varied in this week ?**""" +""" \U0001F612 \U0001F600""")
286
  st.bar_chart(df)
287
  st.markdown("""---""")