From 037096fc9b4f37ceb3ff5e084f53062420ddbfb3 Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Tue, 29 Oct 2024 18:52:09 +0530 Subject: [PATCH 1/7] Add Streamlit app for real-time IoT heart rate and stress monitoring --- streamlit_app.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 streamlit_app.py diff --git a/streamlit_app.py b/streamlit_app.py new file mode 100644 index 0000000..7374a22 --- /dev/null +++ b/streamlit_app.py @@ -0,0 +1,34 @@ +import streamlit as st +import random +import time + +st.set_page_config(page_title="SereniFi Guide IoT Dashboard", layout="centered") + +st.title("SereniFi Guide IoT Monitoring Dashboard") +st.write("This dashboard monitors real-time heart rate and stress level data.") + +# Display placeholders for real-time data +heart_rate_display = st.empty() +stress_level_display = st.empty() +status_display = st.empty() + +def simulate_data(): + """Simulate heart rate and stress level data""" + heart_rate = random.randint(60, 100) + stress_level = random.randint(1, 10) + return heart_rate, stress_level + +# Real-time update loop +status_display.write("Monitoring real-time data...") + +while True: + # Simulate or fetch data (replace this with actual IoT data fetching if available) + heart_rate, stress_level = simulate_data() + + # Display the data in real-time + heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") + stress_level_display.metric("Stress Level", f"{stress_level}/10") + + # Refresh data every second + time.sleep(1) +ss \ No newline at end of file From 91f4e39eeb618182ebc500685bc263182fe9ad01 Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Wed, 30 Oct 2024 23:50:38 +0530 Subject: [PATCH 2/7] Add Monitoring (Beta) tab for IoT heart rate and stress monitoring with user connection instructions --- app.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/app.py b/app.py index bdc72a3..0561fdf 100644 --- a/app.py +++ b/app.py @@ -9,6 +9,52 @@ from dotenv import load_dotenv #AI Integration import anthropic +#changes made by --Shibika Roy +import streamlit as st +import random +import time +# Adding tabs for different sections of the app +tabs = st.tabs(["Home", "Guided Meditation", "Breathing Exercises", "Monitoring (Beta)"]) +# Code for the Monitoring (Beta) tab +with tabs[3]: # This references the Monitoring (Beta) tab + st.title("Monitoring (Beta)") + st.write("This feature is in Beta. Connect your IoT-enabled heart rate and stress sensors to view real-time data.") +with tabs[3]: + st.title("Monitoring (Beta)") + st.write("This feature is in Beta. Connect your IoT-enabled heart rate and stress sensors to view real-time data.") + + # Connection Instructions + st.subheader("How to Connect Your Device:") + st.write(""" + 1. Ensure your IoT device is powered on and within Bluetooth range. + 2. Open the Bluetooth settings on your device and pair it with the app. + 3. Once connected, your heart rate and stress level will display below in real time. + """) + +# Display placeholders for real-time data +heart_rate_display = st.empty() +stress_level_display = st.empty() +status_display = st.empty() + +def simulate_data(): + """Simulate heart rate and stress level data""" + heart_rate = random.randint(60, 100) + stress_level = random.randint(1, 10) + return heart_rate, stress_level + +# Real-time update loop +status_display.write("Monitoring real-time data...") + +while True: + # Simulate or fetch data (replace this with actual IoT data fetching if available) + heart_rate, stress_level = simulate_data() + + # Display the data in real-time + heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") + stress_level_display.metric("Stress Level", f"{stress_level}/10") + + # Refresh data every second + time.sleep(1) #Changes made by --Charvi Arora #Added security From 0d67145152e18ca65e28d0963790c940febc2e45 Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Fri, 8 Nov 2024 15:44:36 +0530 Subject: [PATCH 3/7] Add Monitoring (Beta) tab with device connection instructions --- streamlit_app.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 7374a22..06f0316 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -2,11 +2,42 @@ import random import time -st.set_page_config(page_title="SereniFi Guide IoT Dashboard", layout="centered") -st.title("SereniFi Guide IoT Monitoring Dashboard") +# Add navigation options in sidebar +selected_tab = st.sidebar.selectbox("Choose a tab", ["Home", "Monitoring (Beta)", "Other Tabs"]) + +if selected_tab == "Monitoring (Beta)": + # Add code for Monitoring (Beta) tab + + +st.title("Monitoring (Beta)") st.write("This dashboard monitors real-time heart rate and stress level data.") +if selected_tab == "Monitoring (Beta)": + # Add title and connection instructions + st.title("Monitoring (Beta)") + st.subheader("Connect Your Heart Rate and Stress Monitoring Device") + + # Connection instructions + st.markdown(""" + To connect your device, please follow these steps: + + 1. **Enable Bluetooth** on your heart rate monitoring device and the device running this app. + 2. **Select Your Device** from the dropdown below and click **Connect**. + 3. Once connected, your heart rate and stress levels will appear in real-time. + """) + + # Simulated dropdown to select a device (for demonstration purposes) + device_name = st.selectbox("Select Monitoring Device", ["Device 1", "Device 2", "Device 3"]) + + # Simulate a connect button + if st.button("Connect"): + st.success(f"Connected to {device_name}!") + # Simulate real-time data + st.write("Heart Rate: 72 bpm") + st.write("Stress Level: Moderate") + + # Display placeholders for real-time data heart_rate_display = st.empty() stress_level_display = st.empty() From 22f923436e744ef425e93a381dcb973f1b402bb0 Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Fri, 8 Nov 2024 15:55:27 +0530 Subject: [PATCH 4/7] Updated add-streamlit-monitoring with latest main branch changes --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 0561fdf..aea7f95 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ from dotenv import load_dotenv #AI Integration import anthropic -#changes made by --Shibika Roy + import streamlit as st import random import time From 148af668b3571fbbfba58d39bbe0647d1685e17d Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Fri, 8 Nov 2024 16:27:23 +0530 Subject: [PATCH 5/7] Integrate Monitoring (Beta) tab with device connection instructions into main app --- app.py | 77 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/app.py b/app.py index aea7f95..fd6566f 100644 --- a/app.py +++ b/app.py @@ -16,46 +16,57 @@ # Adding tabs for different sections of the app tabs = st.tabs(["Home", "Guided Meditation", "Breathing Exercises", "Monitoring (Beta)"]) # Code for the Monitoring (Beta) tab -with tabs[3]: # This references the Monitoring (Beta) tab - st.title("Monitoring (Beta)") - st.write("This feature is in Beta. Connect your IoT-enabled heart rate and stress sensors to view real-time data.") -with tabs[3]: - st.title("Monitoring (Beta)") - st.write("This feature is in Beta. Connect your IoT-enabled heart rate and stress sensors to view real-time data.") - - # Connection Instructions - st.subheader("How to Connect Your Device:") - st.write(""" - 1. Ensure your IoT device is powered on and within Bluetooth range. - 2. Open the Bluetooth settings on your device and pair it with the app. - 3. Once connected, your heart rate and stress level will display below in real time. - """) +import streamlit as st +import random +import time -# Display placeholders for real-time data -heart_rate_display = st.empty() -stress_level_display = st.empty() -status_display = st.empty() +# Add navigation options in sidebar +selected_tab = st.sidebar.selectbox("Choose a tab", ["Home", "Monitoring (Beta)", "Other Tabs"]) -def simulate_data(): - """Simulate heart rate and stress level data""" - heart_rate = random.randint(60, 100) - stress_level = random.randint(1, 10) - return heart_rate, stress_level +if selected_tab == "Monitoring (Beta)": + st.title("Monitoring (Beta)") + st.subheader("Connect Your Heart Rate and Stress Monitoring Device") -# Real-time update loop -status_display.write("Monitoring real-time data...") + # Connection instructions + st.markdown(""" + To connect your device, please follow these steps: + + 1. **Enable Bluetooth** on your heart rate monitoring device and the device running this app. + 2. **Select Your Device** from the dropdown below and click **Connect**. + 3. Once connected, your heart rate and stress levels will appear in real-time. + """) -while True: - # Simulate or fetch data (replace this with actual IoT data fetching if available) - heart_rate, stress_level = simulate_data() + # Simulated dropdown to select a device (for demonstration purposes) + device_name = st.selectbox("Select Monitoring Device", ["Device 1", "Device 2", "Device 3"]) - # Display the data in real-time - heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") - stress_level_display.metric("Stress Level", f"{stress_level}/10") + # Simulate a connect button + if st.button("Connect"): + st.success(f"Connected to {device_name}!") + + # Display placeholders for real-time data + heart_rate_display = st.empty() + stress_level_display = st.empty() + status_display = st.empty() + + def simulate_data(): + """Simulate heart rate and stress level data""" + heart_rate = random.randint(60, 100) + stress_level = random.randint(1, 10) + return heart_rate, stress_level + + # Real-time update loop + status_display.write("Monitoring real-time data...") + + for _ in range(100): # Use a finite range instead of while True for demonstration + # Simulate or fetch data + heart_rate, stress_level = simulate_data() - # Refresh data every second - time.sleep(1) + # Display the data in real-time + heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") + stress_level_display.metric("Stress Level", f"{stress_level}/10") + # Refresh data every second + time.sleep(1) #Changes made by --Charvi Arora #Added security # Load environment variables from .env file From 22344a96d0f7076ee4f975cbda39961bda8f1742 Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Sat, 9 Nov 2024 01:11:23 +0530 Subject: [PATCH 6/7] Add Monitoring (Beta) tab to streamlit_app.py with device connection instructions --- streamlit_app.py | 588 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 557 insertions(+), 31 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 06f0316..6f87807 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,27 +1,77 @@ import streamlit as st + +# Set page config (must be the first Streamlit command) +st.set_page_config(page_title="Anxiety Relief App", page_icon=":relieved:", layout="centered") + +# Import other required libraries +import base64 +import datetime +import plotly.express as px +import pandas as pd +import requests import random import time +from streamlit_lottie import st_lottie +from streamlit_option_menu import option_menu +import os +from dotenv import load_dotenv +import anthropic + +# Load environment variables from .env file for security +load_dotenv() +claude_api_key = os.getenv("CLAUDE_API_KEY") +# Initialize the Anthropic API client +client = anthropic.Client(api_key=claude_api_key) + +# Define the function for the AI-based anxiety management guide +def anxiety_management_guide(mood, feeling_description, current_stress_level, recent_events): + # Construct the message for ClaudeAI + message = client.messages.create( + model="claude-3-opus-20240229", + max_tokens=250, + temperature=0.2, + system=f"You are a helpful mental health assistant that helps users manage their anxiety...", + messages=[ + { + "role": "user", + "content": [ + { + "type": "text", + "text": f"Task: Help me manage my anxiety. I'm feeling {mood}. Here's what I'm experiencing: {feeling_description}. " + f"My current stress level is {current_stress_level}, and these are some recent events that might have contributed: {recent_events}\n\n" + "Considerations:\nProvide tailored anxiety-reduction exercises.\nConsider the user's mood, stress level, feelings, and recent events.\n" + "Offer practical and effective techniques.\nEnsure the suggestions are easy to follow." + } + ] + } + ] + ) + return message # Add navigation options in sidebar -selected_tab = st.sidebar.selectbox("Choose a tab", ["Home", "Monitoring (Beta)", "Other Tabs"]) +selected_tab = st.sidebar.selectbox("Choose a tab", ["Home", "Guided Meditation", "Breathing Exercises", "Monitoring (Beta)"]) -if selected_tab == "Monitoring (Beta)": - # Add code for Monitoring (Beta) tab +# Implement the different sections for each tab +if selected_tab == "Home": + st.title("Welcome to the Anxiety Relief App") + st.write("Select a tab to explore different resources for managing anxiety.") +elif selected_tab == "Guided Meditation": + st.title("Guided Meditation") + st.write("Explore various guided meditations to help calm your mind.") -st.title("Monitoring (Beta)") -st.write("This dashboard monitors real-time heart rate and stress level data.") +elif selected_tab == "Breathing Exercises": + st.title("Breathing Exercises") + st.write("Practice breathing exercises to reduce stress and promote relaxation.") -if selected_tab == "Monitoring (Beta)": - # Add title and connection instructions +elif selected_tab == "Monitoring (Beta)": st.title("Monitoring (Beta)") st.subheader("Connect Your Heart Rate and Stress Monitoring Device") # Connection instructions st.markdown(""" To connect your device, please follow these steps: - 1. **Enable Bluetooth** on your heart rate monitoring device and the device running this app. 2. **Select Your Device** from the dropdown below and click **Connect**. 3. Once connected, your heart rate and stress levels will appear in real-time. @@ -33,33 +83,509 @@ # Simulate a connect button if st.button("Connect"): st.success(f"Connected to {device_name}!") - # Simulate real-time data - st.write("Heart Rate: 72 bpm") - st.write("Stress Level: Moderate") + # Display placeholders for real-time data + heart_rate_display = st.empty() + stress_level_display = st.empty() + status_display = st.empty() + + def simulate_data(): + """Simulate heart rate and stress level data""" + heart_rate = random.randint(60, 100) + stress_level = random.randint(1, 10) + return heart_rate, stress_level + + # Real-time update loop + status_display.write("Monitoring real-time data...") + for _ in range(100): # Finite loop for demonstration + heart_rate, stress_level = simulate_data() + heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") + stress_level_display.metric("Stress Level", f"{stress_level}/10") + time.sleep(1) + + +# Data for mental health (sampled) +data = { + 'Activity': ['Meditation', 'Yoga', 'Breathing', 'Journaling', 'Music'], + 'Calmness_Level': [85, 78, 90, 75, 88] +} + +df = px.data.tips() # Use your actual anxiety relief data + +@st.cache_data +def get_img_as_base64(file): + with open(file, "rb") as f: + data = f.read() + return base64.b64encode(data).decode() + +# Animated background +page_bg_img = f""" + +""" + +st.markdown(page_bg_img, unsafe_allow_html=True) + + +def load_lottie_url(url: str): + response = requests.get(url) + if response.status_code == 200: + return response.json() + return None + +# Main function to control page navigation +def main(): + + selected = option_menu( + menu_title=None, + options=["Home", "Calm Space", "About & Feedback"], + icons=["house-door-fill", "cloud-sun-fill", "chat-dots-fill"], + menu_icon="sun", + default_index=0, + orientation="horizontal", + styles={ + "container": {"padding": "0!important", "background-color": "#333", "border-radius": "10px", "box-shadow": "0 4px 6px rgba(0, 0, 0, 0.1)"}, + "nav-link": { + "font-size": "18px", + "text-align": "center", + "margin": "0px", + "--hover-color": "#ddd", + "border-radius": "10px", + "color": "#fff", + "background-color": "rgba(0, 0, 0, 0.8)", # More opaque background + "transition": "background-color 0.3s ease, transform 0.2s" + }, + "nav-link-selected": {"background-color": "#04AA6D", "color": "#fff", "transform": "scale(1.1)"} + } + ) + + if selected == "Home": + show_main_page() + elif selected == "Calm Space": + show_calm_space() + elif selected == "About & Feedback": + show_about_and_feedback() + +def show_main_page(): + st.markdown( + """ + +

Welcome to SereniFi

+ """, unsafe_allow_html=True +) + + + st.markdown('

Feel Calm, Centered, and Peaceful

', unsafe_allow_html=True) + + + + st.image("https://images.pexels.com/photos/185801/pexels-photo-185801.jpeg?auto=compress&cs=tinysrgb&w=600", caption="Breathe and Relax", use_column_width=True) + + st.write("---") + + + + # Interactive content + st.markdown(""" + ### Welcome to Your Oasis of Calm + + Imagine a sanctuary where you can escape the hustle and bustle of everyday life—this is your space to recharge and rejuvenate. Embracing mental health is not just about addressing issues; it's about nurturing your inner self and fostering a sense of tranquility. + + **Discover Your Path to Peace:** + - **Mindful Breathing:** Click below to start a guided breathing exercise that helps calm your mind instantly. + - **Relaxation Techniques:** Explore various methods to integrate relaxation into your daily routine. + - **Personalized Tips:** Answer a quick survey to receive tailored advice for enhancing your well-being. + + **Engage with Us:** + - Share your favorite relaxation techniques or feedback on how our platform helps you. + + Your path to a serene and fulfilling life starts here. Let’s embark on this journey together—take the first step today! + """) + + # Interactive Widgets + if st.button('Start Guided Breathing'): + st.balloons() + st.write("**Guided Breathing Exercise:** Inhale deeply through your nose for 4 seconds, hold for 4 seconds, and exhale slowly through your mouth. Repeat this process a few times to feel the calming effect.") + + + st.write("---") + + # Survey for Personalized Tips + st.subheader("Personalized Tips for You") + with st.form(key='personalized_tips_form'): + mood = st.radio("What's your current anxiety level?", ["Low", "Moderate", "High", "Overwhelmed"]) + submit_button = st.form_submit_button("Get Tips") + if submit_button: + tips = { + "Low": "Keep up the great work! Stay consistent with mindfulness techniques.", + "Moderate": "Take a moment to practice deep breathing.", + "High": "Pause and try a guided meditation.", + "Overwhelmed": "It's important to step away and take a break." + } + st.write(f"**Tip:** {tips[mood]}") + + + st.write("---") + + st.markdown(""" + ### Embrace Your Journey to Wellness + + Taking care of your mental health is an ongoing journey that requires attention and effort. It's essential to recognize the value of setting aside time for yourself amidst your busy schedule. Activities such as mindfulness, relaxation exercises, and engaging in hobbies can significantly improve your overall well-being. + + Remember, mental health is not just the absence of mental illness but a state of complete emotional, psychological, and social well-being. Incorporating small, positive changes into your daily routine can lead to a more balanced and fulfilling life. Embrace these practices with an open heart and notice the positive impact they have on your day-to-day life. + """) + + st.video("https://www.youtube.com/watch?v=inpok4MKVLM", start_time=10) + + st.write("---") + + st.markdown('

The Importance of Mental Health

', unsafe_allow_html=True) + + st.write("Mental health is just as important as physical health, but often overlooked. It affects how we think, feel, and act in our daily lives. Prioritizing mental well-being can help us manage stress, connect with others, and make healthier choices.") + + # Interactive section for viewers + st.subheader("Let's Explore How Mental Health Affects You") + + # User input on mental health habits + daily_mindfulness = st.radio("How often do you practice mindfulness or self-care?", ["Daily", "Weekly", "Occasionally", "Rarely"]) + + if daily_mindfulness == "Daily": + st.success("Amazing! Regular self-care routines greatly enhance mental wellness.") + elif daily_mindfulness == "Weekly": + st.info("Great start! Try increasing your self-care sessions to enhance its benefits.") + elif daily_mindfulness == "Occasionally": + st.warning("It's good you're trying! Consistency can help you feel more balanced.") + else: + st.error("Mental health is crucial! Start small by incorporating simple self-care practices.") + + + st.write("---") + + + # Tip for improving mental health + st.subheader("Quick Tip for Mental Health") + if st.button("Get a Tip"): + tips = [ + "Take a few minutes to practice deep breathing daily.", + "Keep a gratitude journal to focus on the positive.", + "Engage in physical activity to boost your mood.", + "Take breaks when you're feeling overwhelmed.", + "Connect with loved ones and share how you're feeling." + ] + st.write(f"Tip: {random.choice(tips)}") + + lottie_url_breathing = "https://lottie.host/89b3ab99-b7ee-4764-ac3a-5fe1ef057bde/WaOPmT23PU.json" + + + lottie_json_breathing = load_lottie_url(lottie_url_breathing) + + + if lottie_json_breathing: + st.markdown( + """ + +
+ """, unsafe_allow_html=True) + + st.markdown('
', unsafe_allow_html=True) + st_lottie(lottie_json_breathing, speed=1, width=300, height=300, key="breathing-animation") + st.markdown('
', unsafe_allow_html=True) + + + + st.markdown('
', unsafe_allow_html=True) + + + + + + st.write("---") + + # Convert data to a DataFrame + df = pd.DataFrame(data) + + # Introduction to the Data Visualization + st.markdown(""" + ### Explore the Impact of Different Activities + + Understanding which activities can best help in reducing anxiety is essential for making informed decisions about your mental wellness. + + Use this visualization to see which activities might work best for you and consider incorporating them into your daily routine. Remember, what works for one person may differ for another, so it's important to explore and find what resonates with you. + """) + + # Interactive Section: Activity Preferences + st.subheader("Which Activities Do You Prefer?") + activities = st.multiselect( + "Select the activities you enjoy or want to try:", + options=df['Activity'], + default=df['Activity'] + ) + + if activities: + st.write("You selected:", ", ".join(activities)) + selected_data = df[df['Activity'].isin(activities)] + fig_selected = px.bar(selected_data, x='Activity', y='Calmness_Level', title="Selected Activities Effectiveness") + st.plotly_chart(fig_selected) + + st.write("---") + st.markdown('

© 2024 Anxiety Relief Platform. All rights reserved.

', unsafe_allow_html=True) + +def soothing_sounds(): + st.header("🎵 Calm Down with Soothing Sounds") + #Contributions made by Himanshi-M + sound_options = { + "Rain": "https://cdn.pixabay.com/audio/2022/05/13/audio_257112ce99.mp3", + "Ocean Waves": "https://cdn.pixabay.com/audio/2022/06/07/audio_b9bd4170e4.mp3", + "Forest": "https://cdn.pixabay.com/audio/2022/03/10/audio_4dedf5bf94.mp3", + "Birds Chirping":"https://cdn.pixabay.com/audio/2022/03/09/audio_c610232c26.mp3", + "River Flowing":"https://cdn.pixabay.com/audio/2024/07/30/audio_319893354c.mp3", + "White Noise":"https://cdn.pixabay.com/audio/2022/03/12/audio_b4f7e5a4ff.mp3", + "Pink Noise": "https://cdn.pixabay.com/audio/2023/10/07/audio_df9c190caf.mp3" + } + selected_sound = st.selectbox("Choose a sound to relax:", list(sound_options.keys())) + # Organizing the button, checkbox and volume slider on the same row + col1, col2, col3 = st.columns([1,1,2]) + with col1: + playbutton=st.button("Play Sound") + with col2: + # Looping Checkbox + loopcheckbox = st.checkbox("Loop Sound") + + if playbutton: + # Rendering the audio player and JS in the app + with col3: + st.audio(sound_options[selected_sound], format="audio/mp3", loop=loopcheckbox) + +def interactive_journal(): + if 'journal_entries' not in st.session_state: + st.session_state.journal_entries = [] + + journal_input = st.text_area("📝 Daily Journal", placeholder="Write down your thoughts...") + if st.button("Save Entry"): + st.session_state.journal_entries.append({ + "date": datetime.datetime.now(), + "entry": journal_input + }) + st.success("Journal entry saved!") + + # Display past journal entries + if st.checkbox("Show Past Entries"): + st.write("### Past Journal Entries:") + for entry in st.session_state.journal_entries: + st.write(f"**{entry['date'].strftime('%Y-%m-%d %H:%M:%S')}**: {entry['entry']}") + +def mood_boosting_mini_games(): + st.markdown("Relax with a fun mini-game to distract your mind. Choose the game yo want:") + st.markdown("[Play Pacman](https://www.google.co.in/search?q=pacman&sca_esv=aaaa9a10aaa1b9d1&sca_upv=1&sxsrf=ADLYWIJzV0yNeS6YptYfZn5AEFUKvBUtSw%3A1725304252827&ei=vA3WZqCaMrLy4-EPiZmBwAw&ved=0ahUKEwig6PmY-6SIAxUy-TgGHYlMAMgQ4dUDCBA&uact=5&oq=pacman&gs_lp=Egxnd3Mtd2l6LXNlcnAiBnBhY21hbjIQEC4YgAQYsQMYQxiDARiKBTIOEC4YgAQYkQIYsQMYigUyEBAAGIAEGLEDGEMYgwEYigUyExAuGIAEGLEDGEMYgwEY1AIYigUyChAuGIAEGEMYigUyChAAGIAEGEMYigUyBRAAGIAEMg0QABiABBixAxhDGIoFMggQABiABBixAzIFEAAYgAQyHxAuGIAEGLEDGEMYgwEYigUYlwUY3AQY3gQY4ATYAQFI3hZQ5A5Y8BRwAXgBkAEAmAHlAaABiwqqAQMyLTa4AQPIAQD4AQGYAgegAp8LwgIKEAAYsAMY1gQYR8ICBBAjGCfCAgoQIxiABBgnGIoFwgILEAAYgAQYkQIYigXCAg4QABiABBixAxiDARiKBcICCxAAGIAEGLEDGIMBwgIOEC4YgAQYkQIY1AIYigXCAhAQLhiABBhDGMcBGIoFGK8BmAMAiAYBkAYGugYGCAEQARgUkgcFMS4wLjagB5Vj&sclient=gws-wiz-serp)") + st.markdown("[Play Thinking Brain](https://kidshelpline.com.au/games/thinking-brain)") + st.markdown("[Play Snake Game](https://www.google.co.in/search?si=ACC90nwm_DCLUGduakF5oU94y1HpDc2j-V_TsJpED11KWNYygOhydoKqqSH9t8iyybygqTEoKMZa&biw=1536&bih=695&dpr=1.25)") + + +def show_calm_space(): + st.title("Calm Space") + st.write("Engage in a breathing exercise to calm your mind.") + + st.subheader("Quick Tips for Positivity") + quick_tips = [ + "Take a deep breath and count to 5.", + "Focus on what you can control, not on what you can't.", + "Take a moment to reflect on something you're grateful for.", + "Smile at yourself in the mirror." + ] + st.write("\n".join(f"- {tip}" for tip in quick_tips)) + + st.write("---") + + # Interactive Section: Daily Challenge Suggestions + st.subheader("Daily Challenge Suggestions") + challenges = { + "Meditation": "Try a 10-minute guided meditation session today. Find a quiet space and focus on your breath.", + "Yoga": "Follow a 15-minute yoga routine to stretch and relax your body. Check out a video for guidance.", + "Breathing": "Engage in deep breathing exercises for 5 minutes. Inhale deeply for 4 seconds, hold for 4 seconds, and exhale slowly.", + "Journaling": "Spend 10 minutes writing down your thoughts and feelings. Reflect on your day and your emotions.", + "Music": "Listen to calming music or nature sounds for 20 minutes. Allow the sounds to help you relax and unwind." + } + + selected_challenge = st.selectbox("Choose an activity for your daily challenge:", options=list(challenges.keys())) + + if selected_challenge: + st.write(f"**Today's Challenge:** {challenges[selected_challenge]}") + st.write("Set a reminder to complete this challenge today. Remember, consistency is key to building habits and improving your mental well-being.") + + st.write("---") + + st.subheader("Daily Anxeity Check") + # Sidebar Inputs + st.subheader("📝 Share Your Current State:") + + mood = st.selectbox("How are you feeling today?", ["Anxious", "Stressed", "Overwhelmed", "Calm", "Other"]) + feeling_description = st.text_area("What exactly are you feeling?", placeholder="Describe your feelings here...") + current_stress_level = st.slider("Current Stress Level (1 to 10)", 1, 10, value=5) + recent_events = st.text_area("Recent Events", placeholder="Describe any recent events that may have contributed to your anxiety or stress...") + + if st.button("Submit"): + st.write("Thank you for sharing. Let’s find some exercises to help you.") + guidance = anxiety_management_guide(mood, feeling_description, current_stress_level, recent_events) + st.write(guidance) + + st.subheader("Mood-Boosting Mini Games") + st.write("Take a break and play a mini-game to reduce your anxiety.") + if st.button("Start Game"): + st.write("Launching a quick mood-boosting game...") + mood_boosting_mini_games() + + st.write("---") + soothing_sounds() + + st.write("---") + + st.subheader("Interactive Journaling") + if st.button("Submit Journal Entry"): + st.success("Journal entry: It's important to reflect and release your emotions.") + interactive_journal() + + + + st.write("---") + st.markdown('

© 2024 Anxiety Relief Platform. All rights reserved.

', unsafe_allow_html=True) + + + + +def show_about_and_feedback(): + st.title("About Us & Feedback") + + st.write(""" + **Welcome to Our Anxiety Relief Platform!** + + We are dedicated to promoting mental wellness through interactive and accessible tools. Our mission is to provide a supportive environment where individuals can explore effective techniques for managing anxiety and improving overall mental well-being. + """) + + st.write(""" + Our team consists of mental health professionals, wellness coaches, and tech enthusiasts who are passionate about making mental health resources accessible to everyone. We believe that everyone deserves a space to find calm, learn about wellness, and connect with supportive tools and communities. + """) + + st.write(""" + **Our Vision** + We envision a world where mental wellness is prioritized and accessible to all. Through innovative solutions and a user-centric approach, we aim to create a space where individuals can find the support they need to thrive. + """) + + st.write(""" + **Meet the Team** + - **Amna Hassan** - Back-end Developer + - **Anushka Pote** - Wellness Coach + - **Madhuri K** - Front-end Developer + - **Pearl Vashishta** - Community Manager + """) + + st.write("---") + + # Interactive Feedback on Activities + st.subheader("Share Your Experience") + st.write(""" + We'd love to hear how these activities are working for you. Your feedback helps others find effective ways to manage anxiety and improve their mental wellness. Feel free to share your thoughts, experiences, or suggestions. + """) + + feedback_activity = st.text_area("How have the activities helped you? Share your experience here:") + if st.button("Submit Feedback"): + if feedback_activity: + st.success("Thank you for sharing your experience! Your feedback is valuable and appreciated.") + + st.write("---") + + # Our Advertising Partners + st.subheader("Our Advertising Partners") + st.write("Check out our partners in mental wellness products and services:") + st.write("- **Mindfulness App**: An app offering guided meditations and mindfulness exercises.") + st.write("- **Relaxation Techniques Guide**: A comprehensive guide to various relaxation techniques and their benefits.") + + st.write("---") + + # Call to Action + st.subheader("Get Involved") + st.write(""" + Interested in supporting our mission? There are several ways you can get involved: + - **Volunteer**: Join our team of volunteers to help others benefit from our platform. + - **Donate**: Support our efforts by contributing to our cause. + - **Share**: Spread the word about our platform to help us reach more people in need. + + For more information, visit our [website](#) or contact us at [info@anxietyrelief.com](mailto:info@anxietyrelief.com). + """) + + st.write("---") + + # Subscribe for Updates + st.subheader("Subscribe for Updates") + st.write("Stay updated with our latest features, activities, and wellness tips.") + email = st.text_input("Enter your email address:") + if st.button("Subscribe"): + if email: + st.success("Thank you for subscribing! You'll receive updates and tips directly to your inbox.") + -# Display placeholders for real-time data -heart_rate_display = st.empty() -stress_level_display = st.empty() -status_display = st.empty() + st.write("---") + st.markdown('

© 2024 Anxiety Relief Platform. All rights reserved.

', unsafe_allow_html=True) -def simulate_data(): - """Simulate heart rate and stress level data""" - heart_rate = random.randint(60, 100) - stress_level = random.randint(1, 10) - return heart_rate, stress_level -# Real-time update loop -status_display.write("Monitoring real-time data...") -while True: - # Simulate or fetch data (replace this with actual IoT data fetching if available) - heart_rate, stress_level = simulate_data() - # Display the data in real-time - heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") - stress_level_display.metric("Stress Level", f"{stress_level}/10") - # Refresh data every second - time.sleep(1) -ss \ No newline at end of file +if __name__ == "__main__": + main() \ No newline at end of file From 62774c69c0208d4b9caa5cc7b9d6ae73ee2cc02c Mon Sep 17 00:00:00 2001 From: Shibika Roy Date: Sun, 10 Nov 2024 18:48:04 +0530 Subject: [PATCH 7/7] Add Monitoring (Beta) tab with connection instructions and real-time data placeholders --- streamlit_app.py | 596 +++-------------------------------------------- 1 file changed, 31 insertions(+), 565 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 6f87807..5244786 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,90 +1,43 @@ import streamlit as st -# Set page config (must be the first Streamlit command) -st.set_page_config(page_title="Anxiety Relief App", page_icon=":relieved:", layout="centered") +# Main App Title +st.title("SereniFi Guide") -# Import other required libraries -import base64 -import datetime -import plotly.express as px -import pandas as pd -import requests -import random -import time -from streamlit_lottie import st_lottie -from streamlit_option_menu import option_menu -import os -from dotenv import load_dotenv -import anthropic +# Tabs for Navigation +tab1, tab2, tab3 = st.tabs(["Calm Space", "Monitoring (Beta)", "About and Feedback"]) -# Load environment variables from .env file for security -load_dotenv() -claude_api_key = os.getenv("CLAUDE_API_KEY") +# Calm Space Tab Content +with tab1: + st.header("Calm Space") + # Existing content for Calm Space + st.write("Welcome to your Calm Space.") -# Initialize the Anthropic API client -client = anthropic.Client(api_key=claude_api_key) - -# Define the function for the AI-based anxiety management guide -def anxiety_management_guide(mood, feeling_description, current_stress_level, recent_events): - # Construct the message for ClaudeAI - message = client.messages.create( - model="claude-3-opus-20240229", - max_tokens=250, - temperature=0.2, - system=f"You are a helpful mental health assistant that helps users manage their anxiety...", - messages=[ - { - "role": "user", - "content": [ - { - "type": "text", - "text": f"Task: Help me manage my anxiety. I'm feeling {mood}. Here's what I'm experiencing: {feeling_description}. " - f"My current stress level is {current_stress_level}, and these are some recent events that might have contributed: {recent_events}\n\n" - "Considerations:\nProvide tailored anxiety-reduction exercises.\nConsider the user's mood, stress level, feelings, and recent events.\n" - "Offer practical and effective techniques.\nEnsure the suggestions are easy to follow." - } - ] - } - ] - ) - return message - -# Add navigation options in sidebar -selected_tab = st.sidebar.selectbox("Choose a tab", ["Home", "Guided Meditation", "Breathing Exercises", "Monitoring (Beta)"]) - -# Implement the different sections for each tab -if selected_tab == "Home": - st.title("Welcome to the Anxiety Relief App") - st.write("Select a tab to explore different resources for managing anxiety.") - -elif selected_tab == "Guided Meditation": - st.title("Guided Meditation") - st.write("Explore various guided meditations to help calm your mind.") - -elif selected_tab == "Breathing Exercises": - st.title("Breathing Exercises") - st.write("Practice breathing exercises to reduce stress and promote relaxation.") - -elif selected_tab == "Monitoring (Beta)": - st.title("Monitoring (Beta)") - st.subheader("Connect Your Heart Rate and Stress Monitoring Device") - - # Connection instructions +# Monitoring (Beta) Tab Content +with tab2: + st.header("Monitoring (Beta)") + st.write("Connect your heart rate and stress monitoring device below.") + + # Instructions for connecting a monitoring device st.markdown(""" - To connect your device, please follow these steps: - 1. **Enable Bluetooth** on your heart rate monitoring device and the device running this app. - 2. **Select Your Device** from the dropdown below and click **Connect**. - 3. Once connected, your heart rate and stress levels will appear in real-time. + **Steps to Connect:** + 1. Enable Bluetooth on your device. + 2. Select your wearable device from the available options below. + - Example Device 1 + - Example Device 2 + 3. Once connected, real-time monitoring data will display here. """) - # Simulated dropdown to select a device (for demonstration purposes) - device_name = st.selectbox("Select Monitoring Device", ["Device 1", "Device 2", "Device 3"]) + # Example placeholders for real-time data + st.metric(label="Heart Rate", value="72 bpm") + st.metric(label="Stress Level", value="Low") - # Simulate a connect button - if st.button("Connect"): - st.success(f"Connected to {device_name}!") +# About and Feedback Tab Content +with tab3: + st.header("About and Feedback") + # Content for About and Feedback + st.write("This section provides information and allows feedback.") - # Display placeholders for real-time data +# Display placeholders for real-time data heart_rate_display = st.empty() stress_level_display = st.empty() status_display = st.empty() @@ -101,491 +54,4 @@ def simulate_data(): heart_rate, stress_level = simulate_data() heart_rate_display.metric("Heart Rate", f"{heart_rate} BPM") stress_level_display.metric("Stress Level", f"{stress_level}/10") - time.sleep(1) - - -# Data for mental health (sampled) -data = { - 'Activity': ['Meditation', 'Yoga', 'Breathing', 'Journaling', 'Music'], - 'Calmness_Level': [85, 78, 90, 75, 88] -} - -df = px.data.tips() # Use your actual anxiety relief data - -@st.cache_data -def get_img_as_base64(file): - with open(file, "rb") as f: - data = f.read() - return base64.b64encode(data).decode() - -# Animated background -page_bg_img = f""" - -""" - -st.markdown(page_bg_img, unsafe_allow_html=True) - - -def load_lottie_url(url: str): - response = requests.get(url) - if response.status_code == 200: - return response.json() - return None - -# Main function to control page navigation -def main(): - - selected = option_menu( - menu_title=None, - options=["Home", "Calm Space", "About & Feedback"], - icons=["house-door-fill", "cloud-sun-fill", "chat-dots-fill"], - menu_icon="sun", - default_index=0, - orientation="horizontal", - styles={ - "container": {"padding": "0!important", "background-color": "#333", "border-radius": "10px", "box-shadow": "0 4px 6px rgba(0, 0, 0, 0.1)"}, - "nav-link": { - "font-size": "18px", - "text-align": "center", - "margin": "0px", - "--hover-color": "#ddd", - "border-radius": "10px", - "color": "#fff", - "background-color": "rgba(0, 0, 0, 0.8)", # More opaque background - "transition": "background-color 0.3s ease, transform 0.2s" - }, - "nav-link-selected": {"background-color": "#04AA6D", "color": "#fff", "transform": "scale(1.1)"} - } - ) - - if selected == "Home": - show_main_page() - elif selected == "Calm Space": - show_calm_space() - elif selected == "About & Feedback": - show_about_and_feedback() - -def show_main_page(): - st.markdown( - """ - -

Welcome to SereniFi

- """, unsafe_allow_html=True -) - - - st.markdown('

Feel Calm, Centered, and Peaceful

', unsafe_allow_html=True) - - - - st.image("https://images.pexels.com/photos/185801/pexels-photo-185801.jpeg?auto=compress&cs=tinysrgb&w=600", caption="Breathe and Relax", use_column_width=True) - - st.write("---") - - - - # Interactive content - st.markdown(""" - ### Welcome to Your Oasis of Calm - - Imagine a sanctuary where you can escape the hustle and bustle of everyday life—this is your space to recharge and rejuvenate. Embracing mental health is not just about addressing issues; it's about nurturing your inner self and fostering a sense of tranquility. - - **Discover Your Path to Peace:** - - **Mindful Breathing:** Click below to start a guided breathing exercise that helps calm your mind instantly. - - **Relaxation Techniques:** Explore various methods to integrate relaxation into your daily routine. - - **Personalized Tips:** Answer a quick survey to receive tailored advice for enhancing your well-being. - - **Engage with Us:** - - Share your favorite relaxation techniques or feedback on how our platform helps you. - - Your path to a serene and fulfilling life starts here. Let’s embark on this journey together—take the first step today! - """) - - # Interactive Widgets - if st.button('Start Guided Breathing'): - st.balloons() - st.write("**Guided Breathing Exercise:** Inhale deeply through your nose for 4 seconds, hold for 4 seconds, and exhale slowly through your mouth. Repeat this process a few times to feel the calming effect.") - - - st.write("---") - - # Survey for Personalized Tips - st.subheader("Personalized Tips for You") - with st.form(key='personalized_tips_form'): - mood = st.radio("What's your current anxiety level?", ["Low", "Moderate", "High", "Overwhelmed"]) - submit_button = st.form_submit_button("Get Tips") - if submit_button: - tips = { - "Low": "Keep up the great work! Stay consistent with mindfulness techniques.", - "Moderate": "Take a moment to practice deep breathing.", - "High": "Pause and try a guided meditation.", - "Overwhelmed": "It's important to step away and take a break." - } - st.write(f"**Tip:** {tips[mood]}") - - - st.write("---") - - st.markdown(""" - ### Embrace Your Journey to Wellness - - Taking care of your mental health is an ongoing journey that requires attention and effort. It's essential to recognize the value of setting aside time for yourself amidst your busy schedule. Activities such as mindfulness, relaxation exercises, and engaging in hobbies can significantly improve your overall well-being. - - Remember, mental health is not just the absence of mental illness but a state of complete emotional, psychological, and social well-being. Incorporating small, positive changes into your daily routine can lead to a more balanced and fulfilling life. Embrace these practices with an open heart and notice the positive impact they have on your day-to-day life. - """) - - st.video("https://www.youtube.com/watch?v=inpok4MKVLM", start_time=10) - - st.write("---") - - st.markdown('

The Importance of Mental Health

', unsafe_allow_html=True) - - st.write("Mental health is just as important as physical health, but often overlooked. It affects how we think, feel, and act in our daily lives. Prioritizing mental well-being can help us manage stress, connect with others, and make healthier choices.") - - # Interactive section for viewers - st.subheader("Let's Explore How Mental Health Affects You") - - # User input on mental health habits - daily_mindfulness = st.radio("How often do you practice mindfulness or self-care?", ["Daily", "Weekly", "Occasionally", "Rarely"]) - - if daily_mindfulness == "Daily": - st.success("Amazing! Regular self-care routines greatly enhance mental wellness.") - elif daily_mindfulness == "Weekly": - st.info("Great start! Try increasing your self-care sessions to enhance its benefits.") - elif daily_mindfulness == "Occasionally": - st.warning("It's good you're trying! Consistency can help you feel more balanced.") - else: - st.error("Mental health is crucial! Start small by incorporating simple self-care practices.") - - - st.write("---") - - - # Tip for improving mental health - st.subheader("Quick Tip for Mental Health") - if st.button("Get a Tip"): - tips = [ - "Take a few minutes to practice deep breathing daily.", - "Keep a gratitude journal to focus on the positive.", - "Engage in physical activity to boost your mood.", - "Take breaks when you're feeling overwhelmed.", - "Connect with loved ones and share how you're feeling." - ] - st.write(f"Tip: {random.choice(tips)}") - - lottie_url_breathing = "https://lottie.host/89b3ab99-b7ee-4764-ac3a-5fe1ef057bde/WaOPmT23PU.json" - - - lottie_json_breathing = load_lottie_url(lottie_url_breathing) - - - if lottie_json_breathing: - st.markdown( - """ - -
- """, unsafe_allow_html=True) - - st.markdown('
', unsafe_allow_html=True) - st_lottie(lottie_json_breathing, speed=1, width=300, height=300, key="breathing-animation") - st.markdown('
', unsafe_allow_html=True) - - - - st.markdown('
', unsafe_allow_html=True) - - - - - - st.write("---") - - # Convert data to a DataFrame - df = pd.DataFrame(data) - - # Introduction to the Data Visualization - st.markdown(""" - ### Explore the Impact of Different Activities - - Understanding which activities can best help in reducing anxiety is essential for making informed decisions about your mental wellness. - - Use this visualization to see which activities might work best for you and consider incorporating them into your daily routine. Remember, what works for one person may differ for another, so it's important to explore and find what resonates with you. - """) - - # Interactive Section: Activity Preferences - st.subheader("Which Activities Do You Prefer?") - activities = st.multiselect( - "Select the activities you enjoy or want to try:", - options=df['Activity'], - default=df['Activity'] - ) - - if activities: - st.write("You selected:", ", ".join(activities)) - selected_data = df[df['Activity'].isin(activities)] - fig_selected = px.bar(selected_data, x='Activity', y='Calmness_Level', title="Selected Activities Effectiveness") - st.plotly_chart(fig_selected) - - st.write("---") - st.markdown('

© 2024 Anxiety Relief Platform. All rights reserved.

', unsafe_allow_html=True) - -def soothing_sounds(): - st.header("🎵 Calm Down with Soothing Sounds") - #Contributions made by Himanshi-M - sound_options = { - "Rain": "https://cdn.pixabay.com/audio/2022/05/13/audio_257112ce99.mp3", - "Ocean Waves": "https://cdn.pixabay.com/audio/2022/06/07/audio_b9bd4170e4.mp3", - "Forest": "https://cdn.pixabay.com/audio/2022/03/10/audio_4dedf5bf94.mp3", - "Birds Chirping":"https://cdn.pixabay.com/audio/2022/03/09/audio_c610232c26.mp3", - "River Flowing":"https://cdn.pixabay.com/audio/2024/07/30/audio_319893354c.mp3", - "White Noise":"https://cdn.pixabay.com/audio/2022/03/12/audio_b4f7e5a4ff.mp3", - "Pink Noise": "https://cdn.pixabay.com/audio/2023/10/07/audio_df9c190caf.mp3" - } - selected_sound = st.selectbox("Choose a sound to relax:", list(sound_options.keys())) - # Organizing the button, checkbox and volume slider on the same row - col1, col2, col3 = st.columns([1,1,2]) - with col1: - playbutton=st.button("Play Sound") - with col2: - # Looping Checkbox - loopcheckbox = st.checkbox("Loop Sound") - - if playbutton: - # Rendering the audio player and JS in the app - with col3: - st.audio(sound_options[selected_sound], format="audio/mp3", loop=loopcheckbox) - -def interactive_journal(): - if 'journal_entries' not in st.session_state: - st.session_state.journal_entries = [] - - journal_input = st.text_area("📝 Daily Journal", placeholder="Write down your thoughts...") - if st.button("Save Entry"): - st.session_state.journal_entries.append({ - "date": datetime.datetime.now(), - "entry": journal_input - }) - st.success("Journal entry saved!") - - # Display past journal entries - if st.checkbox("Show Past Entries"): - st.write("### Past Journal Entries:") - for entry in st.session_state.journal_entries: - st.write(f"**{entry['date'].strftime('%Y-%m-%d %H:%M:%S')}**: {entry['entry']}") - -def mood_boosting_mini_games(): - st.markdown("Relax with a fun mini-game to distract your mind. Choose the game yo want:") - st.markdown("[Play Pacman](https://www.google.co.in/search?q=pacman&sca_esv=aaaa9a10aaa1b9d1&sca_upv=1&sxsrf=ADLYWIJzV0yNeS6YptYfZn5AEFUKvBUtSw%3A1725304252827&ei=vA3WZqCaMrLy4-EPiZmBwAw&ved=0ahUKEwig6PmY-6SIAxUy-TgGHYlMAMgQ4dUDCBA&uact=5&oq=pacman&gs_lp=Egxnd3Mtd2l6LXNlcnAiBnBhY21hbjIQEC4YgAQYsQMYQxiDARiKBTIOEC4YgAQYkQIYsQMYigUyEBAAGIAEGLEDGEMYgwEYigUyExAuGIAEGLEDGEMYgwEY1AIYigUyChAuGIAEGEMYigUyChAAGIAEGEMYigUyBRAAGIAEMg0QABiABBixAxhDGIoFMggQABiABBixAzIFEAAYgAQyHxAuGIAEGLEDGEMYgwEYigUYlwUY3AQY3gQY4ATYAQFI3hZQ5A5Y8BRwAXgBkAEAmAHlAaABiwqqAQMyLTa4AQPIAQD4AQGYAgegAp8LwgIKEAAYsAMY1gQYR8ICBBAjGCfCAgoQIxiABBgnGIoFwgILEAAYgAQYkQIYigXCAg4QABiABBixAxiDARiKBcICCxAAGIAEGLEDGIMBwgIOEC4YgAQYkQIY1AIYigXCAhAQLhiABBhDGMcBGIoFGK8BmAMAiAYBkAYGugYGCAEQARgUkgcFMS4wLjagB5Vj&sclient=gws-wiz-serp)") - st.markdown("[Play Thinking Brain](https://kidshelpline.com.au/games/thinking-brain)") - st.markdown("[Play Snake Game](https://www.google.co.in/search?si=ACC90nwm_DCLUGduakF5oU94y1HpDc2j-V_TsJpED11KWNYygOhydoKqqSH9t8iyybygqTEoKMZa&biw=1536&bih=695&dpr=1.25)") - - -def show_calm_space(): - st.title("Calm Space") - st.write("Engage in a breathing exercise to calm your mind.") - - st.subheader("Quick Tips for Positivity") - quick_tips = [ - "Take a deep breath and count to 5.", - "Focus on what you can control, not on what you can't.", - "Take a moment to reflect on something you're grateful for.", - "Smile at yourself in the mirror." - ] - st.write("\n".join(f"- {tip}" for tip in quick_tips)) - - st.write("---") - - # Interactive Section: Daily Challenge Suggestions - st.subheader("Daily Challenge Suggestions") - challenges = { - "Meditation": "Try a 10-minute guided meditation session today. Find a quiet space and focus on your breath.", - "Yoga": "Follow a 15-minute yoga routine to stretch and relax your body. Check out a video for guidance.", - "Breathing": "Engage in deep breathing exercises for 5 minutes. Inhale deeply for 4 seconds, hold for 4 seconds, and exhale slowly.", - "Journaling": "Spend 10 minutes writing down your thoughts and feelings. Reflect on your day and your emotions.", - "Music": "Listen to calming music or nature sounds for 20 minutes. Allow the sounds to help you relax and unwind." - } - - selected_challenge = st.selectbox("Choose an activity for your daily challenge:", options=list(challenges.keys())) - - if selected_challenge: - st.write(f"**Today's Challenge:** {challenges[selected_challenge]}") - st.write("Set a reminder to complete this challenge today. Remember, consistency is key to building habits and improving your mental well-being.") - - st.write("---") - - st.subheader("Daily Anxeity Check") - # Sidebar Inputs - st.subheader("📝 Share Your Current State:") - - mood = st.selectbox("How are you feeling today?", ["Anxious", "Stressed", "Overwhelmed", "Calm", "Other"]) - feeling_description = st.text_area("What exactly are you feeling?", placeholder="Describe your feelings here...") - current_stress_level = st.slider("Current Stress Level (1 to 10)", 1, 10, value=5) - recent_events = st.text_area("Recent Events", placeholder="Describe any recent events that may have contributed to your anxiety or stress...") - - if st.button("Submit"): - st.write("Thank you for sharing. Let’s find some exercises to help you.") - guidance = anxiety_management_guide(mood, feeling_description, current_stress_level, recent_events) - st.write(guidance) - - st.subheader("Mood-Boosting Mini Games") - st.write("Take a break and play a mini-game to reduce your anxiety.") - if st.button("Start Game"): - st.write("Launching a quick mood-boosting game...") - mood_boosting_mini_games() - - st.write("---") - soothing_sounds() - - st.write("---") - - st.subheader("Interactive Journaling") - if st.button("Submit Journal Entry"): - st.success("Journal entry: It's important to reflect and release your emotions.") - interactive_journal() - - - - st.write("---") - st.markdown('

© 2024 Anxiety Relief Platform. All rights reserved.

', unsafe_allow_html=True) - - - - -def show_about_and_feedback(): - st.title("About Us & Feedback") - - st.write(""" - **Welcome to Our Anxiety Relief Platform!** - - We are dedicated to promoting mental wellness through interactive and accessible tools. Our mission is to provide a supportive environment where individuals can explore effective techniques for managing anxiety and improving overall mental well-being. - """) - - st.write(""" - Our team consists of mental health professionals, wellness coaches, and tech enthusiasts who are passionate about making mental health resources accessible to everyone. We believe that everyone deserves a space to find calm, learn about wellness, and connect with supportive tools and communities. - """) - - st.write(""" - **Our Vision** - We envision a world where mental wellness is prioritized and accessible to all. Through innovative solutions and a user-centric approach, we aim to create a space where individuals can find the support they need to thrive. - """) - - st.write(""" - **Meet the Team** - - **Amna Hassan** - Back-end Developer - - **Anushka Pote** - Wellness Coach - - **Madhuri K** - Front-end Developer - - **Pearl Vashishta** - Community Manager - """) - - st.write("---") - - # Interactive Feedback on Activities - st.subheader("Share Your Experience") - st.write(""" - We'd love to hear how these activities are working for you. Your feedback helps others find effective ways to manage anxiety and improve their mental wellness. Feel free to share your thoughts, experiences, or suggestions. - """) - - feedback_activity = st.text_area("How have the activities helped you? Share your experience here:") - if st.button("Submit Feedback"): - if feedback_activity: - st.success("Thank you for sharing your experience! Your feedback is valuable and appreciated.") - - st.write("---") - - # Our Advertising Partners - st.subheader("Our Advertising Partners") - st.write("Check out our partners in mental wellness products and services:") - st.write("- **Mindfulness App**: An app offering guided meditations and mindfulness exercises.") - st.write("- **Relaxation Techniques Guide**: A comprehensive guide to various relaxation techniques and their benefits.") - - st.write("---") - - # Call to Action - st.subheader("Get Involved") - st.write(""" - Interested in supporting our mission? There are several ways you can get involved: - - **Volunteer**: Join our team of volunteers to help others benefit from our platform. - - **Donate**: Support our efforts by contributing to our cause. - - **Share**: Spread the word about our platform to help us reach more people in need. - - For more information, visit our [website](#) or contact us at [info@anxietyrelief.com](mailto:info@anxietyrelief.com). - """) - - st.write("---") - - # Subscribe for Updates - st.subheader("Subscribe for Updates") - st.write("Stay updated with our latest features, activities, and wellness tips.") - email = st.text_input("Enter your email address:") - if st.button("Subscribe"): - if email: - st.success("Thank you for subscribing! You'll receive updates and tips directly to your inbox.") - - - st.write("---") - st.markdown('

© 2024 Anxiety Relief Platform. All rights reserved.

', unsafe_allow_html=True) - - - - - -if __name__ == "__main__": - main() \ No newline at end of file + time.sleep(1) \ No newline at end of file