File size: 5,296 Bytes
e7ba5d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
09d1ec5
51f28ea
f8b215b
f91adf8
51f28ea
f91adf8
51f28ea
b539384
f8b215b
 
f91adf8
f8b215b
 
 
 
 
f91adf8
 
 
f8b215b
f91adf8
f8b215b
f91adf8
 
 
 
 
f8b215b
f91adf8
 
 
f8b215b
f91adf8
 
f8b215b
f91adf8
 
 
f8b215b
f91adf8
 
 
 
 
 
 
 
 
f8b215b
f91adf8
f8b215b
 
f91adf8
 
 
 
f8b215b
f91adf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8b215b
b539384
 
 
 
f91adf8
b539384
f91adf8
 
51f28ea
f91adf8
 
 
 
f8b215b
 
f91adf8
b539384
8e2b12b
 
f91adf8
8e2b12b
f91adf8
074cc6d
f91adf8
f8b215b
 
 
 
 
f91adf8
f8b215b
 
 
b539384
f91adf8
f8b215b
b539384
 
f91adf8
b539384
 
f91adf8
 
51f28ea
f91adf8
 
 
8e2b12b
 
f8b215b
 
 
 
 
b539384
f8b215b
 
f91adf8
 
 
f8b215b
f91adf8
 
 
 
 
f8b215b
e7ba5d7
 
 
 
 
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
import streamlit as st
from transformers import pipeline

def load_model():

    return pipeline(

        "text-generation",

        model="google/flan-t5-base"

    )
 
generator = load_model()

import streamlit as st

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

# 2. Enhanced CSS
st.markdown("""
<style>
    /* Full Page Background */
    [data-testid="stAppViewContainer"] {
        background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), 
                    url("https://images.unsplash.com/photo-1517836357463-d25dfeac3438?q=80&w=2070&auto=format&fit=crop");
        background-size: cover;
        background-position: center;
        background-attachment: fixed;
    }
    /* Hide the "Press Enter to submit form" hint globally */
    [data-testid="InputInstructions"] {
        display: none !important;
    }
    /* Form Container Polish */
    div[data-testid="stForm"] {
        background-color: rgba(255, 255, 255, 0.98) !important;
        padding: 3rem !important;
        border-radius: 20px !important;
        border: none !important;
        box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    }
    /* --- FONT SIZE UPDATES --- */
    /* Main Title (FitPlan AI) */
    .main-title {
        color: #FFFFFF !important;
        font-size: 60px !important;
        font-weight: 850 !important;
        text-align: center;
        margin-bottom: 0px;
        text-shadow: 3px 3px 6px rgba(0,0,0,0.9);
        font-family: 'Helvetica Neue', sans-serif;
    }
    /* Subtitle (Your personalized gym companion) */
    .sub-title {
        color: #E0E0E0 !important;
        font-size: 24px !important;
        text-align: center;
        margin-top: -10px;
        margin-bottom: 40px;
        font-style: italic;
        text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    }
    /* Form Section Headers (Orange) */
    .form-header {
        color: #f97316 !important;
        font-size: 22px !important;
        font-weight: bold !important;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    /* Labels for inputs */
    label p {
        font-size: 18px !important;
        color: #1e293b !important;
        font-weight: 600 !important;
    }
    /* Button Styling */
    .stButton > button {
        width: 100%;
        background: linear-gradient(90deg, #f97316, #ea580c) !important;
        color: white !important;
        font-size: 20px !important;
        font-weight: bold !important;
        height: 3.5rem !important;
        border-radius: 12px !important;
        border: none !important;
        margin-top: 20px;
    }
</style>
""", unsafe_allow_html=True)

# --------------------------------------------------
# UI Header Section
# --------------------------------------------------
st.markdown('<p class="main-title">πŸ’ͺ FitPlan AI</p>', unsafe_allow_html=True)
st.markdown('<p class="sub-title">Your personalized gym companion</p>', unsafe_allow_html=True)

# --------------------------------------------------
# Fitness Profile Form
# --------------------------------------------------
with st.form("fitness_form", clear_on_submit=False):
    st.markdown('<p class="form-header">πŸ§β€β™‚οΈ 1. PERSONAL INFORMATION</p>', unsafe_allow_html=True)
    
    name = st.text_input("Full Name *", placeholder="Enter your full name")

    col1, col2 = st.columns(2)
    with col1:
        height = st.number_input("Height (cm) *", min_value=0.0, step=1.0, value=0.0)
    with col2:
        weight = st.number_input("Weight (kg) *", min_value=0.0, step=0.1, value=0.0)

    st.markdown("<br>", unsafe_allow_html=True)
    st.markdown('<p class="form-header">πŸ‹οΈ 2. FITNESS DETAILS</p>', unsafe_allow_html=True)
    
    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"],
                               default=["No Equipment"])
    
    level = st.radio("Fitness Level", ["Beginner", "Intermediate", "Advanced"], horizontal=True)

    # Submission Button
    submit = st.form_submit_button("GENERATE MY PLAN")

# --------------------------------------------------
# Logic & Calculation
# --------------------------------------------------
if submit:
    if not name.strip() or height <= 50 or weight <= 10:
        st.error("🚨 Please provide a valid name, height, and weight.")
    else:
        # BMI Calculation
        height_m = height / 100
        bmi = round(weight / (height_m ** 2), 2)

        if bmi < 18.5:
            cat, color = "Underweight", "blue"
        elif 18.5 <= bmi < 25:
            cat, color = "Normal", "green"
        elif 25 <= bmi < 30:
            cat, color = "Overweight", "orange"
        else:
            cat, color = "Obese", "red"

        # Results Display
        st.balloons()
        st.success(f"βœ… Profile created for {name}")
        
        c1, c2 = st.columns(2)
        with c1:
            st.metric("Calculated BMI", bmi)
        with c2:
            st.markdown(f"### Status: :{color}[{cat}]")
        
        st.info(f"*Goal:* {goal} | *Experience:* {level}")