|
import streamlit as st |
|
import os |
|
|
|
|
|
|
|
def get_recommended_option(level): |
|
if 1 <= level <= 3: |
|
return "Positive Quotes" |
|
elif 4 <= level <= 6: |
|
return "Music Recommendations" |
|
elif 7 <= level <= 8: |
|
return "Physical Activity" |
|
else: |
|
return "Talk to a Friend" |
|
|
|
def get_image_path(level): |
|
image_folder = "emotions.png" |
|
return os.path.join(image_folder) |
|
|
|
def main(): |
|
st.title("Mood Support App") |
|
|
|
|
|
mood_level = st.slider("On a scale of 1-10, how would you rate your mood today?", 1, 10) |
|
|
|
|
|
image_path = get_image_path(mood_level) |
|
if os.path.exists(image_path): |
|
|
|
col1, col2, col3 = st.columns([1,2,1]) |
|
with col2: |
|
st.image(image_path, caption=f"Mood Level: {mood_level}", use_column_width=True) |
|
else: |
|
st.error(f"Image not found: {image_path}") |
|
|
|
|
|
recommended_option = get_recommended_option(mood_level) |
|
st.write(f"Based on your current mood level, we recommend trying the '{recommended_option}' option.") |
|
|
|
|
|
st.header("Support Options") |
|
col1, col2, col3, col4 = st.columns([2,3,2,2]) |
|
|
|
with col1: |
|
if st.button("Positive Quotes"): |
|
st.switch_page("pages/positive_quotes.py") |
|
|
|
with col2: |
|
if st.button("Music Recommendations"): |
|
st.switch_page("pages/music_recommendations.py") |
|
|
|
with col3: |
|
if st.button("Physical Activity"): |
|
st.switch_page("pages/physical_activity.py") |
|
|
|
with col4: |
|
if st.button("Talk to a Friend"): |
|
st.switch_page("pages/talk_to_friend.py") |
|
|
|
|
|
if __name__ == "__main__": |
|
main() |
|
|