Spaces:
Sleeping
Sleeping
File size: 3,202 Bytes
1f6d7ba 7f56c8a 2cf4a4b 1f6d7ba 2cf4a4b c704836 7f56c8a 2cf4a4b 7f56c8a 850b633 7f56c8a 2cf4a4b 850b633 2cf4a4b 850b633 2cf4a4b 850b633 7f56c8a 2cf4a4b 7f56c8a 850b633 2cf4a4b 850b633 8d6f3e2 850b633 8d6f3e2 7f56c8a 8d6f3e2 7f56c8a 2cf4a4b c704836 8d6f3e2 2cf4a4b 8d6f3e2 7f56c8a 8d6f3e2 7f56c8a 850b633 8d6f3e2 7f56c8a 2cf4a4b 7f56c8a 2cf4a4b 7f56c8a 8d6f3e2 2cf4a4b | 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 | import streamlit as st
# ---------------------------------------------------
# PAGE CONFIG
# ---------------------------------------------------
st.set_page_config(page_title="FitPlan AI", layout="wide")
st.title(" FitPlan AI β User Fitness Profile")
# ---------------------------------------------------
# PERSONAL INFORMATION
# ---------------------------------------------------
st.subheader("π€ Personal Information")
name = st.text_input("Enter Your Name")
gender = st.selectbox(
"Gender",
["Male", "Female", "Other"]
)
col1, col2 = st.columns(2)
with col1:
height = st.number_input("Height (in cm)", min_value=100, max_value=250)
with col2:
weight = st.number_input("Weight (in kg)", min_value=30, max_value=200)
# ---------------------------------------------------
# BMI CALCULATION (Basic Logic Only)
# ---------------------------------------------------
bmi = None
if height > 0 and weight > 0:
height_m = height / 100
bmi = weight / (height_m ** 2)
st.write(f"### π Your BMI: {bmi:.2f}")
# ---------------------------------------------------
# FITNESS GOAL
# ---------------------------------------------------
st.subheader("π― Fitness Goal")
goal = st.selectbox(
"",
[
"Flexible",
"Weight Loss",
"Build Muscle",
"Strength Gaining",
"Abs Building"
]
)
# ---------------------------------------------------
# EQUIPMENT
# ---------------------------------------------------
st.subheader("Available Equipment")
col1, col2 = st.columns(2)
with col1:
dumbbells = st.checkbox("Dumbbells")
resistance_band = st.checkbox("Resistance Band")
yoga_mat = st.checkbox("Yoga Mat")
no_equipment = st.checkbox("No Equipment")
with col2:
treadmill = st.checkbox("Treadmill")
cycle = st.checkbox("Cycle")
pullups_bar = st.checkbox("Pullups Bar")
weight_plates = st.checkbox("Weight Plates")
equipment = []
equipment_map = {
"Dumbbells": dumbbells,
"Resistance Band": resistance_band,
"Yoga Mat": yoga_mat,
"No Equipment": no_equipment,
"Treadmill": treadmill,
"Cycle": cycle,
"Pullups Bar": pullups_bar,
"Weight Plates": weight_plates,
}
for item, selected in equipment_map.items():
if selected:
equipment.append(item)
# ---------------------------------------------------
# FITNESS LEVEL
# ---------------------------------------------------
st.subheader("π Fitness Level")
fitness_level = st.radio(
"",
["Beginner", "Intermediate", "Advanced"],
horizontal=True
)
# ---------------------------------------------------
# SUBMIT BUTTON (Backend Receiving Data)
# ---------------------------------------------------
if st.button("Submit Profile"):
if not name:
st.error("Please enter your name.")
elif not equipment:
st.error("Please select at least one equipment option.")
else:
st.success("β
Profile Submitted Successfully!")
st.json({
"Name": name,
"Gender": gender,
"BMI": round(bmi, 2) if bmi else None,
"Goal": goal,
"Fitness Level": fitness_level,
"Equipment": equipment
})
|