Spaces:
Runtime error
Runtime error
File size: 35,758 Bytes
d11985a 443f5c2 d11985a 10a912b d11985a 10a912b d11985a 443f5c2 d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 10a912b d11985a 663de44 d11985a 663de44 d11985a 663de44 443f5c2 663de44 d11985a 663de44 443f5c2 663de44 443f5c2 d11985a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
import streamlit as st
import numpy as np
import pandas as pd
from transformers import pipeline
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
nltk.download('punkt')
nltk.download('stopwords')
from transformers import AutoTokenizer, AutoModelForSequenceClassification
def calculate(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10):
score = 0
for i in [q4,q5,q7,q8]:
if i == 'Very Often':
score += 0
elif i == 'Fairly Often':
score += 1
elif i == 'Sometimes':
score += 2
elif i == 'Almost':
score += 3
elif i == 'Never':
score += 4
for i in [q1,q2,q3,q6,q9,q10]:
if i == 'Very Often':
score += 4
elif i == 'Fairly Often':
score += 3
elif i == 'Sometimes':
score += 2
elif i == 'Almost':
score += 1
elif i == 'Never':
score += 0
return score
def home_page():
st.write("# Mental Health Well Being App! \U0001f64f")
st.markdown(
"""
A platform where we celebrate mental well-being and make our users proactive and motivated to take charge of their own mental health
How?
1. Bring awareness to a user of relevant available self help solutions based on series of daily journal entries for a week
2. Provide the user with their Perceived Stress Scale Score [PSS](https://www.das.nh.gov/wellness/docs/percieved%20stress%20scale.pdf) and informative trends to help them navigate the seriousness of any underlying mental challenges
3. Feature happy memories using AI, encourage gratefulness and eventually reinforce behavioral change
**👈 Click the dropdown to explore more**
"""
)
def PSS_monthly():
st.write("## Ready to know your score on Perceived Stress Scale (PSS) for this month?")
st.markdown("""This tool assess how different situations affect your feelings and your perceived stress. The questions in this scale ask about your feelings and thoughts during the last month.""")
st.sidebar.success("Select one of our offerings from above. For better results, follow the sequence")
st.sidebar.image("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYWFRgWFRYYGRgYGR4cHBwcGBoaHB0cGhgaGhoaGhweIS4nHCErIRocJjgmKy8xNTU1GiQ7QDs0Py40NTEBDAwMEA8QHBISHTQrJSs2NDQ0NDQ0NDY0NDQ0NDE0NDQ0NTQ0NDQ0NDQ0NDQ0NDQ0NDE0MTQ0NDQ0NDE0NDQ0NP/AABEIAP0AxwMBIgACEQEDEQH/xAAcAAEAAQUBAQA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UKH0ubTlPycLdNXjsRlRps+iKzH9IJ+0+ivZdsc4bAJmFnqsarDpmsFHoqr63kcU9k1WdEBBLMq6HUZiADY8RrxF5OeHoqiKi6KqhR5AWE7Y5eTC9ERNIREQEREBERAREQEREBERA8nOb27sjGqgFQ02pklSBmBDAAhhcdBznSTySyWaqy2XcRa/syxGbMMUhbqUYHoPxHlLVT2X4lvixafyOf+4SV4mJxYT4155Iow3smqDRsdYcwlIjXTmanQdJ2G6W51HAl2R6lR6gAZnI4LcgKABbies6eJuSRnZIT2/tk/wAVUvmS1Vgyka2DEa9dALSbJgY3ZdCt/wCrRp1P8SKxHkSNJz5eOZzVawy8aiCpvSBSdUOufMoIOt1UE9NANPWaTE7wMwGYi/O2nPThzk0tuVgD/wDFp+gIHyBtKqO5uAU3GEoE/qQN/qvOGP4eEu3TLmtRHuxttnxNBFpvVYVVJCi9hnF3Nr2AGp5aSepaw+GRBZFVR0VQo+Ql2erHHUcbdvYiJpCIiAiIgIiIH//Z",use_column_width=True
)
with st.form(key='Questionaire_monthly'):
question1 = st.selectbox(
'1. In the last month, how often have you been upset because of something that happened unexpectedly?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question2 = st.selectbox(
'2. In the last month, how often have you felt that you were unable to control the important things in your life?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question3 = st.selectbox(
'3. In the last month, how often have you felt nervous and "stressed"?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question4 = st.selectbox(
'4. In the last month, how often have you felt confident about your ability to handle your personal problems?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question5 = st.selectbox(
'5. In the last month, how often have you felt that things were going your way?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question6 = st.selectbox(
'6. In the last month, how often have you found that you could not cope with all the things that you had to do?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question7 = st.selectbox(
'7. In the last month, how often have you been able to control irritations in your life?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question8 = st.selectbox(
'8. In the last month, how often have you felt that you were on top of things?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question9 = st.selectbox(
'9. In the last month, how often have you been angered because of things that were outside of your control?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question10 = st.selectbox(
'10. In the last month, how often have you felt difficulties were piling up so high that you could not overcome them?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
submit_button = st.form_submit_button(label='Submit')
if submit_button:
score = calculate(question1,question2,question3,question4,question5,question6,question7,question8,question9,question10)
st.write(f'Your Stress score : {score}/40 ')
st.markdown("""**Here is how you progressed in the previous months**""")
#Synthetic data created for the given user for 6 days
df = pd.DataFrame(np.random.randint(10,40,(8,1)),columns=["Score"])
df['Month'] = ['01/01','02/01','03/01','04/01','05/01','06/01','07/01','08/01']
df.loc[7, 'Score'] = score
df = df.set_index('Month')
st.bar_chart(df)
st.markdown("""---""")
st.markdown("""Worried that you are a victim of stress? ***You are not alone*** and we are in a shared space.""")
st.markdown("""How other users stand with you in Stress levels""")
#Synthetic data created for other users
members_scores = pd.DataFrame(np.random.randint(0,40,(40,2)),columns=['score','count'])
members_scores = members_scores.groupby(['score'])['count'].agg('sum').reset_index()#.rename(columns={'count':'No. of Users'})
#st.dataframe(members_scores)
#if score in members_scores['score']:
# members_scores.loc[len(members_scores.index)]= [score,1+members_scores[members_scores['score']==score]['No. of Users']]
#else:
# members_scores.loc[len(members_scores.index)]= [score,1]
#st.dataframe(members_scores)
#fig = plt.figure(figsize=(10, 4))
#plt.scatter(members_scores['score'], members_scores['No. of Users'],s=[5*i for i in members_scores['No. of Users']])
#plt.scatter(score,members_scores[members_scores['score']==score]['No. of Users'],marker="*",color='r')
#st.balloons()
#plt.xlabel('Perceived Stress Scale')
#plt.ylabel('No. of Users')
#st.pyplot(fig)
#st.markdown("""---""")
st.vega_lite_chart(members_scores, {
'mark': {'type': 'circle', 'tooltip': True},
'encoding': {
'x': {'field': 'score', 'type': 'quantitative'},
'y': {'field': 'count', 'type': 'quantitative'},
'size': {'field': 'score', 'type': 'quantitative'},
'color': {'field': 'score', 'type': 'quantitative'},
},
},use_container_width=True)
def PSS():
st.write("## Ready to know your score on Perceived Stress Scale (PSS) for this week?")
st.markdown("""This tool assess how different situations affect your feelings and your perceived stress. The questions in this scale ask about your feelings and thoughts during the last week.""")
st.sidebar.success("Select one of our offerings from above. For better results, follow the sequence")
st.sidebar.image("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYWFRgWFRYYGRgYGR4cHBwcGBoaHB0cGhgaGhoaGhweIS4nHCErIRocJjgmKy8xNTU1GiQ7QDs0Py40NTEBDAwMEA8QHBISHTQrJSs2NDQ0NDQ0NDY0NDQ0NDE0NDQ0NTQ0NDQ0NDQ0NDQ0NDQ0NDE0MTQ0NDQ0NDE0NDQ0NP/AABEIAP0AxwMBIgACEQEDEQH/xAAcAAEAAQUBAQAAAAAAAAAAAAAABwIDBAUGAQj/xABAEAACAQIDBgMGBAQFAgcAAAABAgADEQQSIQUGMUFRYSJxgQcTMpGhsUJSYtEUksHwcoKy4fEjwhUWMzREY6L/xAAZAQEBAQEBAQAAAAAAAAAAAAAAAQIDBAX/xAAgEQEBAAICAwADAQAAAAAAAAAAAQIRAyESMUEEE1Fh/9oADAMBAAIRAxEAPwCZoiICIiAiIgIiICJC++e/OMTFVqdGp7tab5AAqm+U8TmB1JPK3Kdz7Pt6/wCOw7M4Aq0iFe3A3F1cDlex06gybXTromO+LA4ayg439Jk8oi/VqKqlmICqCSTwAAuSfSRltL2u01fLRos6A/EzZSw/SttPU+k7fa9cVaFWlYg1KbqOl2QgX+cgmnuDjnqe7yIL/jaooTTv8Xplje1T5sDbdHGURWoNmU6EEEFWHFSDwIvNrOW3C3Y/gMP7tnzu7Z3IuFDFVFlB5AKNefHThOpmkIiICIiAiIgIiICIiAiIgIiICIiAnkSkmS3Q5XeHcbC4qp71w6ObZihAzAfm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
with st.form(key='Questionaire'):
question1 = st.selectbox(
'1. In the last week, how often have you been upset because of something that happened unexpectedly?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question2 = st.selectbox(
'2. In the last week, how often have you felt that you were unable to control the important things in your life?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question3 = st.selectbox(
'3. In the last week, how often have you felt nervous and "stressed"?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question4 = st.selectbox(
'4. In the last week, how often have you felt confident about your ability to handle your personal problems?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question5 = st.selectbox(
'5. In the last week, how often have you felt that things were going your way?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question6 = st.selectbox(
'6. In the last week, how often have you found that you could not cope with all the things that you had to do?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question7 = st.selectbox(
'7. In the last week, how often have you been able to control irritations in your life?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question8 = st.selectbox(
'8. In the last week, how often have you felt that you were on top of things?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question9 = st.selectbox(
'9. In the last week, how often have you been angered because of things that were outside of your control?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
question10 = st.selectbox(
'10. In the last week, how often have you felt difficulties were piling up so high that you could not overcome them?',
('Very Often', 'Fairly Often', 'Sometimes','Almost','Never'))
submit_button = st.form_submit_button(label='Submit')
if submit_button:
score = calculate(question1,question2,question3,question4,question5,question6,question7,question8,question9,question10)
st.write(f'Your Stress score : {score}/40 ')
def daily_log():
model_path = "cardiffnlp/twitter-xlm-roberta-base-sentiment"
sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
st.markdown("""***Hey there!! 👋 Ready to track your daily progress*** \u270D\uFE0F""")
with st.form(key='Sentiment'):
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.")
submit_button = st.form_submit_button(label='Submit')
if 'thought_key' not in st.session_state:
st.session_state['thought_key'] = False
if submit_button:
st.session_state['thought_key'] = True
if st.session_state['thought_key']:
out = sentiment_task(prompt)
if out[0]['label'] =='Positive':
score = out[0]['score']
st.write(f'Yay!! You are having a great day and we know that you are worth of it \U0001f60d')
elif out[0]['label'] =='Negative':
st.write("Sorry you had a bad day but you always have an another day to improve \U0001f91d \U0001f917")
habit = st.selectbox('Did you stick with the habit?',('Yes', 'No'))
history = ["\U0001F612","\U0001F600","\U0001F600","\U0001F612","\U0001F600","\U0001F612"]
days = ['Day1', 'Day2', 'Day3', 'Day4', 'Day5', 'Day6']
button = st.button('Track',key='hbt_button')
df = pd.DataFrame(list(zip(days, history)), columns =['Days','Emotions'])
df = df.set_index('Days')
if 'habit_key' not in st.session_state:
st.session_state['habit_key'] = False
if button:
st.session_state['habit_key'] = True
if st.session_state['habit_key']:
#if button:
if habit=='Yes':
st.write("Well Done, Keep it up!! \u2705")
df.loc['Day7'] = ["\U0001F600"]
elif habit=='No':
st.write("Don't worry, you can catch up again tomorrow")
df.loc['Day7'] = ["\U0001F612"]
#st.bar_chart(df)
#Steps Calculator
st.markdown("""---""")
no_of_steps = st.text_input('Steps Walked Today', 0)
no_of_steps = int(no_of_steps)
stp_history = [5000,1250,4850,1890,6000,4500]
stp_days = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6']
stp_button = st.button('Track',key='stp_button')
stp_df = pd.DataFrame(list(zip(stp_days, stp_history)), columns =['Days','Steps'])
stp_df = stp_df.set_index('Days')
if 'stp_key' not in st.session_state:
st.session_state['stp_key'] = False
if stp_button:
st.session_state['stp_key'] = True
if st.session_state['stp_key']:
#if stp_button:
if no_of_steps>=0:
st.write("Well Done, Keep it up!! \u2705")
stp_df.loc['Day7'] = [no_of_steps]
st.markdown("""---""")
# Sleep
no_of_hrs = st.text_input('Hours Slept', '0')
no_of_hrs = int(no_of_hrs)
hrs_history = [7,7.5,8,7.5,6,8]
hrs_days = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6']
slp_button = st.button('Track',key='slp_button')
slp_df = pd.DataFrame(list(zip(hrs_days, hrs_history)), columns =['Days','Hours slept'])
slp_df = slp_df.set_index('Days')
if 'slp_key' not in st.session_state:
st.session_state['slp_key'] = False
if slp_button:
st.session_state['slp_key'] = True
if st.session_state['slp_key']:
#if slp_button:
if no_of_hrs>=0:
st.write("Well Done, Keep it up!! \u2705")
slp_df.loc['Day7'] = [no_of_hrs]
#slp_df = slp_df.copy(deep=False)
#st.dataframe(slp_df)
st.markdown("""---""")
st.markdown("""**Gratitude Journal**""")
st.markdown("""Use the below prompt and reflect on what you are grateful for today. We will provide you our insights \U0001f929 """)
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.')
grt_button = st.button('Get me things that I love the most',key='grt_button')
if 'grt_key' not in st.session_state:
st.session_state['grt_key'] = False
if grt_button:
st.session_state['grt_key'] = True
if st.session_state['grt_key']:
#if grt_button:
#Synthetic data
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
stop_words = set(stopwords.words('english'))
word_tokens = word_tokenize(grt_text)
filtered_sentence = [w for w in word_tokens if not w.lower() in stop_words]
filtered_sentence = []
for w in word_tokens:
if w not in stop_words and len(w)>3 :
filtered_sentence.append(w)
filtered_words = ' '.join(map(str,filtered_sentence))
wordcloud = WordCloud().generate(filtered_words)
# Display the generated image:
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.show()
st.set_option('deprecation.showPyplotGlobalUse', False)
st.markdown("""**We found these to be your favourites**""" +""" \U0001f60d""")
st.pyplot()
st.markdown("""**May be you should doing things that makes you grateful**""" +""" \U0001f596""")
st.markdown("""\n""")
st.markdown("""---""")
st.markdown("""**Want to know how you are doing in this week ?**""" +""" \U0001f4c8""")
trd_button = st.button('Display Trends',key='trds_button')
if 'trd_key' not in st.session_state:
st.session_state['trd_key'] = False
if trd_button:
st.session_state['trd_key'] = True
if st.session_state['trd_key']:
#if trd_button:
st.markdown("""**How your emotions varied in this week ?**""" +""" \U0001F612 \U0001F600""")
st.bar_chart(df)
st.markdown("""---""")
st.markdown("""**Track of your step count in this week ?**""" +""" \U0001f45f""")
st.line_chart(stp_df)
st.markdown("""---""")
st.markdown("""**Track of hours you slept in this week ?**""" +""" \U0001f4a4""")
st.line_chart(slp_df)
st.markdown("""---""")
check_box_prb = st.checkbox('I have completed my 7 days of tracking and I am ready to know your recomendation')
#st.dataframe(slp_df)
if 'cb_key' not in st.session_state:
st.session_state['cb_key'] = False
if check_box_prb:
st.session_state['cb_key'] = True
if st.session_state['cb_key']:
if check_box_prb:
#slp_df = slp_df.copy(deep=False)
if slp_df.shape[0] == 7:
#st.write(slp_df.shape[0])
st.write("That's Awesome! Keep the momentum going!")
st.markdown("""**Why don't you share what you are going through? This would help us to give a better recommendation**""")
classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')
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.""")
prb_button = st.button(label='Submit',key='probsubmit')
#slp_df = slp_df.copy(deep=False)
#st.dataframe(slp_df)
if 'prbsol_key' not in st.session_state:
st.session_state['prbsol_key'] = False
if prb_button:
st.session_state['prbsol_key'] = True
if st.session_state['prbsol_key']:
#st.dataframe(slp_df)
#slp_df = slp_df.copy(deep=False)
candidate_labels = ["Sleep-disorder", "Work-stress", "Peer pressure"]
res = classifier(sent, candidate_labels)
problem = res['labels'][0]
st.write('We feel working on ',problem ,' could improve your overall well-being')
st.markdown("""#### Not sure where to start? """+ """ \U0001f914 """+""" Here are our recommendations!! \U0001f917""")
#st.markdown("""###Not sure where to start?###"""+ """ \U0001f914 """+""" ###Here are our recommendations!!### \U0001f917""")
if problem == 'Sleep-disorder':
st.write("Try this [Mediatation for Sleep on Headspace](https://www.headspace.com/meditation/sleep)")
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
elif problem == 'Work-stress':
st.write("Try this [Mediatation for Anxiety on Headspace](https://www.headspace.com/meditation/anxiety)")
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
elif problem == 'Peer pressure':
st.write("Try this [Calm Down Meditation](https://www.headspace.com/articles/how-to-calm-down)")
st.write("Try this [Yammer community for Mindfulness](https://web.yammer.com/main/org/optum.com/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI1NzMxOTMxNzUwNCJ9/new)")
#st.write(type(res['labels']))
else:
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>'
st.markdown(warning, unsafe_allow_html=True)
#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')
page_names_to_funcs = {
"Home": home_page,
"Daily Log": daily_log,
"Weekly - Perceived Stress Scale": PSS,
"Monthly - Perceived Stress Scale": PSS_monthly
}
#st.set_page_config(page_title="Mental Well Being", layout="wide")
#st.markdown(
#"""
#<style>
# [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
# width: 250px;
# }
# [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
# width: 250px;
# margin-left: -250px;
# }
#
# """,
# unsafe_allow_html=True,
#)
demo_name = st.sidebar.selectbox("Choose one of our offerings", page_names_to_funcs.keys())
page_names_to_funcs[demo_name]() |