Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .streamlit/secrets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEMINI_API_KEY = "AIzaSyDsLJgA58LvgFtnUdVBLFb08GZQV0wXYjQ"
1 change: 1 addition & 0 deletions assets/yoga_animation.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"menu_items": None
}

st.set_page_config(**PAGE_CONFIG)
#st.set_page_config(**PAGE_CONFIG)

# ---------- Custom Dropdown Style ----------
st.markdown("""
Expand Down
91 changes: 91 additions & 0 deletions data/Yoga.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"Anxious": {
"sanskrit_name": "Viparita Karani",
"english_name": "Legs-Up-the-Wall Pose",
"benefit": "Relieves anxiety and calms the nervous system.",
"steps": [
"Lie on your back and extend your legs up against a wall.",
"Keep your arms relaxed at your sides.",
"Breathe deeply and relax for 5-15 minutes."
]
},
"Sad": {
"sanskrit_name": "Balasana",
"english_name": "Child's Pose",
"benefit": "Soothes sadness and encourages inner reflection.",
"steps": [
"Kneel down and sit back on your heels.",
"Bend forward and stretch your arms in front of you.",
"Rest your forehead on the mat and take deep breaths."
]
},
"Stressed": {
"sanskrit_name": "Bhramari Pranayama",
"english_name": "Bee Breath",
"benefit": "Reduces stress and relaxes the mind through calming vibrations.",
"steps": [
"Sit comfortably with your spine straight.",
"Close your eyes and take a deep breath in.",
"Exhale slowly while making a humming sound like a bee.",
"Repeat this for 5-10 rounds."
]
},
"Motivated": {
"sanskrit_name": "Surya Namaskar",
"english_name": "Sun Salutation",
"benefit": "Boosts energy, motivation, and positivity through a full-body flow.",
"steps": [
"Stand tall in Mountain Pose with hands in prayer.",
"Inhale, raise your arms overhead and arch back slightly.",
"Exhale, fold forward and place your hands on the ground.",
"Inhale, lift your head and chest halfway up.",
"Exhale, step back into a plank and lower to the floor.",
"Inhale into Cobra pose.",
"Exhale into Downward Dog and hold.",
"Inhale, step forward, and repeat the flow for 3-5 rounds."
]
},
"Tired": {
"sanskrit_name": "Savasana",
"english_name": "Corpse Pose",
"benefit": "Promotes deep rest and rejuvenation.",
"steps": [
"Lie flat on your back with legs extended and arms by your sides.",
"Close your eyes and let your entire body relax.",
"Focus on your breath and stay in this pose for 5-10 minutes."
]
},
"Angry": {
"sanskrit_name": "Simhasana",
"english_name": "Lion's Breath",
"benefit": "Releases anger and tension through expressive breath.",
"steps": [
"Sit in a comfortable kneeling position.",
"Inhale deeply through the nose.",
"Exhale forcefully through the mouth while sticking out your tongue and roaring like a lion.",
"Repeat for 5 rounds."
]
},
"Lonely": {
"sanskrit_name": "Matsyasana",
"english_name": "Fish Pose",
"benefit": "Opens the heart center and promotes emotional release.",
"steps": [
"Lie on your back and slide your hands under your hips.",
"Press your forearms and elbows into the ground.",
"Lift your chest and gently drop your head back.",
"Hold for 5 breaths, then relax."
]
},
"Joyful": {
"sanskrit_name": "Natarajasana",
"english_name": "Dancer's Pose",
"benefit": "Celebrates balance, grace, and self-expression.",
"steps": [
"Stand tall and shift your weight to your left foot.",
"Bend your right knee and hold your ankle from behind.",
"Extend your left arm forward and lift your right leg up.",
"Hold for 5-7 breaths, then switch sides."
]
}
}
145 changes: 145 additions & 0 deletions pages/Yoga.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import streamlit as st
import json
import os
from streamlit_lottie import st_lottie

st.set_page_config(page_title="🧘 Yoga for Mental Health", layout="centered")

def load_lottiefile(filepath: str):
try:
with open(filepath, "r") as f:
return json.load(f)
except FileNotFoundError:
return None

lottie_yoga = load_lottiefile("assets/yoga_animation.json")

# --- Load Yoga Data ---
try:
with open(os.path.join("data", "Yoga.json"), "r") as f:
yoga_data = json.load(f)
except FileNotFoundError:
yoga_data = {}

#--CSS--
st.markdown("""
<style>
/* Base background */
html, body, [data-testid="stAppViewContainer"],
[data-testid="stVerticalBlock"],
section[data-testid="stVerticalBlock"] > div,
div[style*="background-color: transparent"],
div[style*="background: transparent"],
div:empty {
background-color: #ffe6f2 !important;
margin: 0 !important;
padding: 0 !important;
border: none !important;
box-shadow: none !important;
height: auto;
visibility: visible;
}

/* Sidebar visually distinct */
[data-testid="stSidebar"] {
background-color: #fdd0e8 !important;
border-right: 2px solid #f5a7d0 !important;
}

/* Header strip */
header[data-testid="stHeader"] {
background-color: #ffe6f2 !important;
}

/* Remove bars/separators */
hr, div[role="separator"], [data-testid="stHorizontalBlock"],
div[style*="rgba(245"], div[style*="#f5"], div[style*="rgb(245"] {
display: none !important;
height: 0 !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
background: transparent !important;
box-shadow: none !important;
visibility: hidden !important;
}

/* Block padding */
.block-container {
padding-top: 0rem !important;
margin-top: 0rem !important;
}

/* Animation container */
.lottie-container {
margin-top: -20px;
margin-bottom: -10px;
padding: 15px;
border-radius: 12px;
background-color: #fcd5ec;
display: flex;
justify-content: center;
}

/* Cursor fix for dropdown */
div[data-testid="stSelectbox"] * {
cursor: pointer !important;
}

/* Watermark effect for placeholder */
div[data-testid="stSelectbox"] > div:first-child > div {
color: gray !important;
font-style: italic !important;
}

/* Disable typing in dropdown input */
.stSelectbox input {
pointer-events: none !important;
caret-color: transparent !important;
user-select: none !important;
background-color: #fff0f6 !important;
}
</style>
""", unsafe_allow_html=True)

# --- Animation ---
st.markdown('<div class="lottie-container">', unsafe_allow_html=True)
if lottie_yoga:
st_lottie(lottie_yoga, height=220, key="yoga")
st.markdown('</div>', unsafe_allow_html=True)

# --- Title & Description ---
st.markdown("<h1 style='text-align: center; color: #b833a2; margin-top: -15px;'>🧘‍♀️ Yoga for Mental Wellness</h1>", unsafe_allow_html=True)
st.markdown("<p style='text-align: center; font-size: 17px;'>Choose your mood and explore a calming yoga asana to support your mind and body.</p>", unsafe_allow_html=True)

# --- Dropdown --
def format_mood(option):
return "Select your mood" if option == "Select your mood" else option

mood_options = ["Select your mood"] + list(yoga_data.keys())
selected_mood = st.selectbox(
"🌸 How are you feeling today?",
options=mood_options,
index=0,
format_func=format_mood,
key="mood_selector"
)

# --- Asana Section ---
if selected_mood != "Select your mood":
asana = yoga_data.get(selected_mood)
if asana:
st.markdown("<div style='background-color: #fff0f6; padding: 1.2rem; border-radius: 16px; margin-top: 1rem;'>", unsafe_allow_html=True)
st.markdown(f"<div style='font-size: 24px; font-weight: bold; color: #a94ca7;'>🧘 {asana.get('sanskrit_name')} ({asana.get('english_name')})</div>", unsafe_allow_html=True)
st.markdown(f"<p style='font-size: 16px; font-style: italic; color: #555;'>💖 {asana.get('benefit')}</p>", unsafe_allow_html=True)

with st.expander("📋 Steps to Perform"):
steps = asana.get("steps", [])
if steps:
for i, step in enumerate(steps, 1):
fixed_step = step.replace("–", "–").replace("​", "")
st.markdown(f"<div style='background-color: #ffe6f2; border-left: 4px solid #d85fa7; padding: 0.5rem; border-radius: 10px; margin-bottom: 0.4rem; font-size: 15px;'>{i}. {fixed_step}</div>", unsafe_allow_html=True)
else:
st.markdown("<div>No steps available for this asana.</div>", unsafe_allow_html=True)

st.markdown("</div>", unsafe_allow_html=True)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ streamlit_modal
google-generativeai
geopy
requests
Pillow
Pillow
streamlit-lottie
3 changes: 2 additions & 1 deletion streamlit.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GEMINI_API_KEY = "AIzaSyDsLJgA58LvgFtnUdVBLFb08GZQV0wXYjQ"
GEMINI_API_KEY = "AIzaSyDsLJgA58LvgFtnUdVBLFb08GZQV0wXYjQ"