Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| # --- PAGE CONFIGURATION --- | |
| st.set_page_config( | |
| page_title="Fitness Plan AI", | |
| page_icon="πͺ", | |
| layout="wide", | |
| initial_sidebar_state="expanded", | |
| ) | |
| # --- CUSTOM CSS FOR MODERN LOOK --- | |
| st.markdown(""" | |
| <style> | |
| /* Main background and text */ | |
| .main { | |
| background-color: #0e1117; | |
| } | |
| /* Header styling */ | |
| .stTitle { | |
| font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
| color: #00FF88; /* Neon Green */ | |
| text-align: center; | |
| padding-bottom: 20px; | |
| } | |
| /* Sidebar styling */ | |
| section[data-testid="stSidebar"] { | |
| background-color: #161b22; | |
| border-right: 1px solid #30363d; | |
| } | |
| /* Input box focus colors */ | |
| input:focus { | |
| border-color: #00FF88 !important; | |
| } | |
| /* Custom button styling */ | |
| div.stButton > button:first-child { | |
| background-color: #00FF88; | |
| color: #000000; | |
| font-weight: bold; | |
| border-radius: 10px; | |
| width: 100%; | |
| height: 50px; | |
| border: none; | |
| transition: 0.3s; | |
| } | |
| div.stButton > button:hover { | |
| background-color: #00CC6A; | |
| transform: scale(1.02); | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # --- SIDEBAR: USER PROFILE --- | |
| with st.sidebar: | |
| st.image("https://cdn-icons-png.flaticon.com/512/2936/2936886.png", width=100) | |
| st.title("User Profile") | |
| st.write("Fill in your stats to get a precise plan.") | |
| age = st.number_input("Age", min_value=10, max_value=100, value=25) | |
| gender = st.radio("Gender", ["Male", "Female", "Other"], horizontal=True) | |
| weight = st.number_input("Weight (kg)", min_value=30.0, max_value=250.0, value=70.0) | |
| height = st.number_input("Height (cm)", min_value=100, max_value=250, value=175) | |
| st.divider() | |
| experience = st.select_slider( | |
| "Fitness Level", | |
| options=["Beginner", "Intermediate", "Advanced"] | |
| ) | |
| # --- MAIN PAGE AREA --- | |
| st.title("πͺ Fitness Plan AI") | |
| st.markdown("### Personalized Fitness Plan Generator") | |
| # Top row of inputs | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| goal = st.selectbox( | |
| "What is your primary goal?", | |
| ['Weight Loss', 'Build Muscle', 'Strength Gaining', 'Flexibility', 'Abs Building'], | |
| index=1 | |
| ) | |
| st.info(f"Targeting: **{goal}**") | |
| with col2: | |
| activity_level = st.selectbox( | |
| "Current Activity Level", | |
| ["Sedentary", "Lightly Active", "Moderately Active", "Very Active"] | |
| ) | |
| equipment = st.multiselect( | |
| "Available Equipment", | |
| ["Full Gym", "Dumbbells", "Resistance Bands", "Bodyweight Only"], | |
| default=["Bodyweight Only"] | |
| ) | |
| # Generate Button | |
| if st.button("Generate My AI Fitness Plan"): | |
| with st.spinner("Analyzing your stats and crafting your plan..."): | |
| # This is where your AI logic would go. | |
| # For now, we show a professional placeholder layout. | |
| st.success(f"Generated a {goal} plan for a {experience} level athlete!") | |
| tab1, tab2, tab3 = st.tabs(["π Weekly Schedule", "π₯ Nutrition Guide", "π‘ Pro Tips"]) | |
| with tab1: | |
| st.markdown("#### Your 7-Day Workout Routine") | |
| # Example layout for the generated plan | |
| st.table({ | |
| "Day": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], | |
| "Focus": ["Upper Body", "Lower Body", "Rest", "Cardio", "Full Body", "Active Recovery", "Rest"], | |
| "Duration": ["45 min", "50 min", "-", "30 min", "60 min", "20 min", "-"] | |
| }) | |
| with tab2: | |
| st.markdown("#### Recommended Daily Macros") | |
| m1, m2, m3 = st.columns(3) | |
| m1.metric("Protein", "160g") | |
| m2.metric("Carbs", "210g") | |
| m3.metric("Fats", "65g") | |
| st.info("Estimated Daily Calories: **2,150 kcal**") | |
| with tab3: | |
| st.write("1. **Stay Hydrated:** Drink at least 3L of water.") | |
| st.write("2. **Sleep:** Aim for 7-9 hours for muscle recovery.") | |
| st.write("3. **Consistency:** Stick to the plan for 4 weeks to see results.") | |
| # --- FOOTER --- | |
| st.markdown("---") | |
| st.caption("Powered by AI β’ Optimized for your health.") |