Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,7 +122,84 @@ if not st.session_state.logged_in:
|
|
| 122 |
|
| 123 |
st.stop()
|
| 124 |
|
| 125 |
-
#
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
st.
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
st.stop()
|
| 124 |
|
| 125 |
+
# =====================================================
|
| 126 |
+
# 💪 WORKOUT GENERATOR PAGE
|
| 127 |
+
# =====================================================
|
| 128 |
|
| 129 |
+
st.markdown('<div class="title">💪 AI Personalized 5-Day Workout Planner</div>', unsafe_allow_html=True)
|
| 130 |
+
|
| 131 |
+
with st.container():
|
| 132 |
+
|
| 133 |
+
st.markdown('<div class="card">', unsafe_allow_html=True)
|
| 134 |
+
|
| 135 |
+
name = st.text_input("Name")
|
| 136 |
+
|
| 137 |
+
age = st.number_input("Age", 10, 80)
|
| 138 |
+
|
| 139 |
+
gender = st.selectbox(
|
| 140 |
+
"Gender",
|
| 141 |
+
["Male", "Female", "Other"]
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
height = st.number_input("Height (cm)", 100, 250)
|
| 145 |
+
|
| 146 |
+
weight = st.number_input("Weight (kg)", 30, 200)
|
| 147 |
+
|
| 148 |
+
goal = st.selectbox(
|
| 149 |
+
"Fitness Goal",
|
| 150 |
+
[
|
| 151 |
+
"Build Muscle",
|
| 152 |
+
"Weight Loss",
|
| 153 |
+
"Strength Gain",
|
| 154 |
+
"Abs Building",
|
| 155 |
+
"Flexibility"
|
| 156 |
+
]
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
fitness_level = st.selectbox(
|
| 160 |
+
"Fitness Level",
|
| 161 |
+
[
|
| 162 |
+
"Beginner",
|
| 163 |
+
"Intermediate",
|
| 164 |
+
"Advanced"
|
| 165 |
+
]
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
equipment = st.multiselect(
|
| 169 |
+
"Available Equipment",
|
| 170 |
+
[
|
| 171 |
+
"Dumbbells",
|
| 172 |
+
"Resistance Band",
|
| 173 |
+
"Yoga Mat",
|
| 174 |
+
"Skipping Rope",
|
| 175 |
+
"Pullups Bar",
|
| 176 |
+
"Inclined Bench",
|
| 177 |
+
"Weight Plates"
|
| 178 |
+
]
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
if st.button("Generate 5-Day Plan 💪"):
|
| 182 |
+
|
| 183 |
+
prompt, bmi, bmi_status = build_prompt(
|
| 184 |
+
name, age, gender,
|
| 185 |
+
height, weight,
|
| 186 |
+
goal, fitness_level,
|
| 187 |
+
equipment
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
st.subheader(f"📊 BMI: {bmi:.2f} ({bmi_status})")
|
| 191 |
+
|
| 192 |
+
with st.spinner("Generating your AI workout plan..."):
|
| 193 |
+
|
| 194 |
+
result = query_model(prompt)
|
| 195 |
+
|
| 196 |
+
st.markdown("## 🗓️ Your Workout Plan")
|
| 197 |
+
st.markdown(result)
|
| 198 |
+
|
| 199 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
# ---------- LOGOUT ----------
|
| 203 |
+
if st.button("Logout"):
|
| 204 |
+
st.session_state.logged_in = False
|
| 205 |
+
st.rerun()
|