Vedica / src /streamlit_app.py
krish-sai's picture
Update src/streamlit_app.py
aee3fbd verified
Raw History Blame Contribute Delete
2.77 kB
import streamlit as st
import base64
# βœ… Set Page Config
st.set_page_config(
page_title="The Ayurveda Explorer",
layout="wide",
initial_sidebar_state="auto" # Or "collapsed"
)
# βœ… Background image function
def set_bg(image_file):
with open(image_file, "rb") as f:
data = f.read()
encoded = base64.b64encode(data).decode()
css = f"""
<style>
.stApp {{
background-image: url("data:image/png;base64,{encoded}");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}}
</style>
"""
st.markdown(css, unsafe_allow_html=True)
# πŸ” Load local background image
# Make sure 'background.png' is in the same directory as Homepage.py
try:
set_bg("background.png")
except FileNotFoundError:
st.warning("background.png not found. Please add it to your project root.")
# βœ… Title
st.markdown("""
<h1 style='text-align: center; color: #3e1a00; font-size: 48px;'>
🌿 Vedica: Ayurveda Explorer
</h1>
""", unsafe_allow_html=True)
st.markdown("""
<h3 style='text-align: center; color: #a5d42b; font-size: 24px;'>
Welcome to Vedica – explore the depth and wisdom of traditional Indian healing.
</h3>
""", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True) # Adding a little space
st.markdown("<h4 style='text-align: center;'>Use the buttons below to begin your journey:</h4>", unsafe_allow_html=True)
# --- KEY CHANGE: Button Navigation Using st.switch_page ---
# This is the modern and recommended way to navigate.
# First Row
spacer, col1, col2, col3, spacer2 = st.columns([0.5, 1, 1, 1, 0.5])
with col1:
if st.button("πŸ“œ History & Origins", use_container_width=True):
st.switch_page("Pages/history_and_Origins.py")
with col2:
if st.button("🌿 Principles of Ayurveda", use_container_width=True):
st.switch_page("Pages/principles_of_Ayurveda.py")
with col3:
if st.button("🩺 Symptom & Cure Guide", use_container_width=True):
st.switch_page("Pages/Symptoms snd solutions.py")
st.markdown("<br>", unsafe_allow_html=True)
# Second Row
spacer, col4, col5, col6, spacer2 = st.columns([0.5, 1, 1, 1, 0.5])
with col4:
if st.button("πŸ•‰οΈ Sound Therapy", use_container_width=True):
st.switch_page("Pages/Sound_Therapy.py")
with col5:
if st.button("🌱 Poisonous Plants & Ayurvedic Antidote", use_container_width=True):
st.switch_page("Pages/Ayurvedic_maps.py")
with col6:
if st.button("🧘 Yoga Asana", use_container_width=True):
st.switch_page("Pages/Yoga_Asana.py")
st.markdown("---")
st.info("Tip: You can also use the sidebar for full navigation at any time.")