| | import streamlit as st |
| |
|
| | |
| | |
| | |
| | st.set_page_config( |
| | page_title="FitPlan AI", |
| | page_icon="πͺ", |
| | layout="centered" |
| | ) |
| |
|
| | |
| | |
| | |
| | st.markdown(""" |
| | <style> |
| | /* Force a clean, light background for the whole app */ |
| | .stApp { |
| | background-color: #F0F2F6; |
| | } |
| | |
| | /* Card-style container for the form */ |
| | div[data-testid="stForm"] { |
| | background-color: #FFFFFF !important; |
| | padding: 30px !important; |
| | border-radius: 15px !important; |
| | border: 1px solid #E0E0E0 !important; |
| | box-shadow: 0 4px 12px rgba(0,0,0,0.05); |
| | } |
| | |
| | /* Force all text labels and headers to be Dark Blue/Black */ |
| | h1, h2, h3, p, label, .stMarkdown { |
| | color: #1A1C25 !important; |
| | } |
| | |
| | /* Style the Input boxes for clarity */ |
| | input { |
| | color: #1A1C25 !important; |
| | background-color: #F8F9FA !important; |
| | } |
| | |
| | /* Button styling */ |
| | .stButton > button { |
| | width: 100%; |
| | background: linear-gradient(90deg, #2563eb, #1d4ed8); |
| | color: white !important; |
| | font-weight: bold; |
| | border: none; |
| | padding: 10px; |
| | border-radius: 8px; |
| | } |
| | </style> |
| | """, unsafe_allow_html=True) |
| |
|
| | |
| | |
| | |
| | st.title("πͺ FitPlan AI") |
| | st.markdown("### Milestone 1: Fitness Profile & BMI Analysis") |
| | st.write("Complete your profile below to calculate your health metrics.") |
| |
|
| | |
| | |
| | |
| | with st.form("fitness_form"): |
| | st.markdown("#### π§ββοΈ 1. Personal Information") |
| | |
| | name = st.text_input("Full Name *", placeholder="e.g. John Doe") |
| |
|
| | col1, col2 = st.columns(2) |
| | with col1: |
| | |
| | height = st.number_input("Height (cm) *", min_value=0.0, step=1.0, format="%.1f") |
| | with col2: |
| | weight = st.number_input("Weight (kg) *", min_value=0.0, step=0.1, format="%.1f") |
| |
|
| | st.markdown("---") |
| |
|
| | st.markdown("#### ποΈ 2. Fitness Details") |
| | |
| | goal = st.selectbox( |
| | "Fitness Goal", |
| | ["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexible"] |
| | ) |
| |
|
| | equipment = st.multiselect( |
| | "Available Equipment (Select all that apply)", |
| | ["Dumbbells", "Resistance Band", "Yoga Mat", "Kettlebell", "Pull-up Bar", "No Equipment"], |
| | default=["No Equipment"] |
| | ) |
| |
|
| | level = st.radio( |
| | "Fitness Level", |
| | ["Beginner", "Intermediate", "Advanced"], |
| | horizontal=True |
| | ) |
| |
|
| | submit = st.form_submit_button("Generate Profile") |
| |
|
| | |
| | |
| | |
| | if submit: |
| | |
| | if not name.strip(): |
| | st.error("π¨ Name is required.") |
| | elif height <= 50 or weight <= 10: |
| | st.error("π¨ Please enter valid height and weight values.") |
| | else: |
| | |
| | height_m = height / 100 |
| | bmi = weight / (height_m ** 2) |
| | bmi_display = round(bmi, 2) |
| |
|
| | |
| | if bmi < 18.5: |
| | category, color, progress = "Underweight", "blue", 0.25 |
| | elif 18.5 <= bmi < 25.0: |
| | category, color, progress = "Normal", "green", 0.50 |
| | elif 25.0 <= bmi < 30.0: |
| | category, color, progress = "Overweight", "orange", 0.75 |
| | else: |
| | category, color, progress = "Obese", "red", 1.0 |
| |
|
| | |
| | st.success(f"β
Profile generated for {name}") |
| | |
| | m_col1, m_col2 = st.columns(2) |
| | with m_col1: |
| | st.metric("Your BMI", f"{bmi_display}") |
| | with m_col2: |
| | |
| | st.markdown(f"**Status:** :{color}[{category}]") |
| |
|
| | st.markdown("### π BMI Visual Indicator") |
| | st.progress(progress) |
| | |
| | |
| | st.info(f"**Profile Summary:**\n\n* **Goal:** {goal}\n* **Experience:** {level}\n* **Equipment:** {', '.join(equipment) if equipment else 'None'}") |