import streamlit as st import time import streamlit.components.v1 as components st.set_page_config(page_title="FitPlan AI Elite", page_icon="💎", layout="wide") # ============================= # GLOBAL STYLING # ============================= st.markdown(""" """, unsafe_allow_html=True) # ============================= # HERO # ============================= st.markdown("

💎 FitPlan AI Elite

", unsafe_allow_html=True) st.markdown("

Train Smart. Perform Elite.

", unsafe_allow_html=True) # ============================= # FEATURE SECTION (FIXED VERSION) # ============================= components.html("""

🔥 Next-Gen AI Fitness Intelligence

📊

Smart BMI

Precision tracking.

🏋️

AI Plans

Elite workouts.

Progression

Optimized growth.

""", height=420) # ============================= # FORM # ============================= name = st.text_input("Full Name") height_cm = st.number_input("Height (cm)", min_value=0, step=1) weight_kg = st.number_input("Weight (kg)", min_value=0) goal = st.selectbox("Goal", ["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexible"] ) level = st.selectbox("Level", ["Beginner", "Intermediate", "Advanced"] ) equipment = st.multiselect("Equipment", ["Dumbbells", "Resistance Band", "Yoga Mat", "Bench", "Pullup Bar"] ) generate = st.button("Generate Elite Plan 🚀") # ============================= # LOGIC # ============================= def calculate_bmi(height_cm, weight_kg): if height_cm == 0: return 0 return round(weight_kg / ((height_cm/100) ** 2), 2) def bmi_category(bmi): if bmi < 18.5: return "Underweight" elif bmi < 25: return "Normal" elif bmi < 30: return "Overweight" else: return "Obese" def generate_workout(goal, level): base = { "Build Muscle": ["Squats – 4x12", "Bench Press – 4x10", "Pullups – 3x8"], "Weight Loss": ["Burpees – 3x15", "Jump Rope – 5 min", "Mountain Climbers – 3x20"], "Strength Gain": ["Deadlift – 5x5", "Overhead Press – 4x6"], "Abs Building": ["Plank – 3x60s", "Leg Raises – 3x15"], "Flexible": ["Yoga Flow – 20 min", "Stretching – 15 min"] } plan = base.get(goal, []) if level == "Intermediate": plan = [p + " 🔥" for p in plan] elif level == "Advanced": plan = [p + " 💪" for p in plan] return plan # ============================= # RESULTS # ============================= if generate: if name and height_cm > 0 and weight_kg > 0: bmi = calculate_bmi(height_cm, weight_kg) category = bmi_category(bmi) st.markdown("---") st.subheader(f"👤 {name}") st.markdown(f"### BMI: {bmi}") st.markdown(f"### Category: {category}") progress = min(bmi/40,1.0) bar = st.progress(0) for i in range(int(progress*100)): time.sleep(0.01) bar.progress(i+1) st.markdown("## 🏋️ Your Personalized Plan") for w in generate_workout(goal, level): st.markdown(f"✅ {w}") if equipment: st.markdown("### 🛠 Equipment Selected") st.write(", ".join(equipment)) else: st.error("Please fill all required fields.")