Download src/streamlit_app.py from krish-sai/Vedica: direct link, hf CLI and curl.
- Browser
- Download file 2.77 kB
-
https://huggingface.co/spaces/krish-sai/Vedica/resolve/main/src/streamlit_app.py
- Command line
-
hf download hf://spaces/krish-sai/Vedica/src/streamlit_app.py
-
curl -L -o streamlit_app.py https://huggingface.co/spaces/krish-sai/Vedica/resolve/main/src/streamlit_app.py
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.") | |