| | import streamlit as st |
| |
|
| | |
| | |
| | |
| | st.set_page_config( |
| | page_title="FitPlan AI", |
| | page_icon="πͺ", |
| | layout="centered" |
| | ) |
| |
|
| | |
| | |
| | |
| | st.markdown(""" |
| | <style> |
| | |
| | /* Page background */ |
| | .stApp { |
| | background-color: #f4f7fb; |
| | } |
| | |
| | /* Main container */ |
| | .block-container { |
| | background-color: #ffffff; |
| | padding: 2.5rem; |
| | border-radius: 18px; |
| | max-width: 900px; |
| | } |
| | |
| | /* Headings */ |
| | h1, h2, h3 { |
| | color: #0f172a !important; |
| | } |
| | |
| | /* Labels */ |
| | label { |
| | color: #1e293b !important; |
| | font-weight: 600; |
| | } |
| | |
| | /* Inputs */ |
| | input, textarea { |
| | background-color: #ffffff !important; |
| | color: #0f172a !important; |
| | border-radius: 10px !important; |
| | border: 1px solid #cbd5e1 !important; |
| | } |
| | |
| | /* Selectbox & Multiselect */ |
| | div[data-baseweb="select"] { |
| | background-color: #ffffff !important; |
| | border-radius: 10px; |
| | } |
| | |
| | /* Form card */ |
| | div[data-testid="stForm"] { |
| | background-color: #f8fafc; |
| | padding: 2rem; |
| | border-radius: 14px; |
| | box-shadow: 0 10px 25px rgba(0,0,0,0.08); |
| | } |
| | |
| | /* Main button */ |
| | .stButton > button { |
| | width: 100%; |
| | height: 3.2em; |
| | border-radius: 10px; |
| | background: linear-gradient(90deg, #2563eb, #1d4ed8); |
| | color: white !important; |
| | font-size: 17px; |
| | font-weight: 600; |
| | border: none; |
| | } |
| | |
| | </style> |
| | """, unsafe_allow_html=True) |
| |
|
| | |
| | |
| | |
| | st.title("πͺ FitPlan AI") |
| | st.subheader("Milestone 1: Fitness Profile & BMI Analysis") |
| | st.write("Enter your details to calculate BMI and generate your fitness profile.") |
| |
|
| | |
| | |
| | |
| | with st.form("fitness_form"): |
| |
|
| | |
| | st.header("π§ββοΈ 1. Personal Information") |
| |
|
| | name = st.text_input("Full Name *") |
| |
|
| | col1, col2 = st.columns(2) |
| | with col1: |
| | height = st.number_input("Height (cm) *", min_value=0.0, step=0.1) |
| | with col2: |
| | weight = st.number_input("Weight (kg) *", min_value=0.0, step=0.1) |
| |
|
| | st.divider() |
| |
|
| | |
| | st.header("ποΈ 2. Fitness Details") |
| |
|
| | goal = st.selectbox( |
| | "Fitness Goal", |
| | ["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexible"] |
| | ) |
| |
|
| | equipment = st.multiselect( |
| | "Available Equipment", |
| | ["Dumbbells", "Resistance Band", "Yoga Mat", |
| | "Kettlebell", "Pull-up Bar", "No Equipment"] |
| | ) |
| |
|
| | level = st.radio( |
| | "Fitness Level", |
| | ["Beginner", "Intermediate", "Advanced"] |
| | ) |
| |
|
| | submit = st.form_submit_button("Generate Profile") |
| |
|
| | |
| | |
| | |
| | if submit: |
| |
|
| | |
| | if not name.strip(): |
| | st.error("β Please enter your name.") |
| | elif height <= 0 or weight <= 0: |
| | st.error("β Height and weight must be greater than zero.") |
| | else: |
| | |
| | height_m = height / 100 |
| | bmi = round(weight / (height_m ** 2), 2) |
| |
|
| | |
| | if bmi < 18.5: |
| | category = "Underweight" |
| | color = "blue" |
| | progress = bmi / 18.5 |
| | elif 18.5 <= bmi < 24.9: |
| | category = "Normal" |
| | color = "green" |
| | progress = bmi / 24.9 |
| | elif 25 <= bmi < 29.9: |
| | category = "Overweight" |
| | color = "orange" |
| | progress = bmi / 29.9 |
| | else: |
| | category = "Obese" |
| | color = "red" |
| | progress = 1.0 |
| |
|
| | |
| | st.success(f"β
Profile created successfully for **{name}**") |
| |
|
| | colA, colB = st.columns(2) |
| | with colA: |
| | st.metric("Your BMI", bmi) |
| | with colB: |
| | st.markdown(f"**BMI Category:** :{color}[{category}]") |
| |
|
| | |
| | st.markdown("### π BMI Progress Indicator") |
| | st.progress(min(progress, 1.0)) |
| |
|
| | |
| | st.info(f"π― Goal: {goal} | π Level: {level}") |
| |
|
| | if equipment: |
| | st.write("π§° Equipment:", ", ".join(equipment)) |
| | else: |
| | st.write("π§° Equipment: No equipment selected") |
| |
|