File size: 4,617 Bytes
09d1ec5
51f28ea
b539384
8e2b12b
b539384
 
 
 
 
 
51f28ea
b539384
2e65e3d
b539384
51f28ea
b539384
2e65e3d
 
b539384
2e65e3d
b539384
51f28ea
2e65e3d
b539384
2e65e3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b539384
2e65e3d
 
b539384
 
2e65e3d
b539384
 
2e65e3d
 
 
 
 
 
b539384
 
2e65e3d
b539384
 
 
 
 
 
8e2b12b
 
2e65e3d
51f28ea
b539384
 
 
8e2b12b
b539384
2e65e3d
 
b539384
 
 
8e2b12b
 
2e65e3d
8e2b12b
2e65e3d
51f28ea
8e2b12b
51f28ea
2e65e3d
 
b539384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51f28ea
b539384
 
 
2e65e3d
b539384
 
 
2e65e3d
8e2b12b
b539384
2e65e3d
 
51f28ea
b539384
2e65e3d
 
8e2b12b
b539384
8e2b12b
 
 
2e65e3d
8e2b12b
 
 
2e65e3d
b539384
8e2b12b
 
2e65e3d
8e2b12b
 
 
2e65e3d
51f28ea
2e65e3d
 
b539384
 
 
 
 
 
 
2e65e3d
 
 
 
 
b539384
 
 
2e65e3d
b539384
2e65e3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import streamlit as st

# --------------------------------------------------
# Page Configuration
# --------------------------------------------------
st.set_page_config(
    page_title="FitPlan AI",
    page_icon="πŸ’ͺ",
    layout="centered"
)

# --------------------------------------------------
# Custom CSS (HF Compatible + Visible UI)
# --------------------------------------------------
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)

# --------------------------------------------------
# Title Section
# --------------------------------------------------
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.")

# --------------------------------------------------
# Fitness Profile Form
# --------------------------------------------------
with st.form("fitness_form"):

    # -------- Section 1 --------
    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()

    # -------- Section 2 --------
    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")

# --------------------------------------------------
# Processing & Output
# --------------------------------------------------
if submit:

    # -------- Validation --------
    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:
        # -------- BMI Calculation --------
        height_m = height / 100
        bmi = round(weight / (height_m ** 2), 2)

        # -------- BMI Classification --------
        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

        # -------- Results Section --------
        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}]")

        # -------- BMI Progress Bar --------
        st.markdown("### πŸ“Š BMI Progress Indicator")
        st.progress(min(progress, 1.0))

        # -------- Summary --------
        st.info(f"🎯 Goal: {goal} | πŸ“ˆ Level: {level}")

        if equipment:
            st.write("🧰 Equipment:", ", ".join(equipment))
        else:
            st.write("🧰 Equipment: No equipment selected")