Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +54 -14
src/streamlit_app.py
CHANGED
|
@@ -19,39 +19,79 @@ st.write("Get a personalized fitness plan based on your details")
|
|
| 19 |
# User Inputs
|
| 20 |
age = st.number_input("Age", min_value=10, max_value=100, step=1)
|
| 21 |
gender = st.selectbox("Gender", ["Male", "Female", "Other"])
|
| 22 |
-
goal = st.selectbox(
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Plan Logic
|
| 26 |
|
| 27 |
-
def generate_plan(
|
| 28 |
plan = ""
|
| 29 |
|
| 30 |
if goal == "Weight Loss":
|
| 31 |
-
plan = "π
|
| 32 |
-
elif goal == "
|
| 33 |
-
plan = "ποΈ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
else:
|
| 35 |
-
plan = "
|
| 36 |
|
| 37 |
-
if
|
| 38 |
-
plan += "
|
| 39 |
-
elif activity == "Medium":
|
| 40 |
-
plan += " Maintain moderate intensity workouts."
|
| 41 |
else:
|
| 42 |
-
plan += "
|
| 43 |
|
| 44 |
return plan
|
| 45 |
|
| 46 |
# Button
|
| 47 |
if st.button("Generate Fitness Plan"):
|
| 48 |
-
plan = generate_plan(
|
| 49 |
st.success("Your Personalized Fitness Plan")
|
| 50 |
st.markdown(f"""
|
| 51 |
**Age:** {age}
|
| 52 |
**Gender:** {gender}
|
| 53 |
**Goal:** {goal}
|
| 54 |
-
**
|
|
|
|
| 55 |
|
| 56 |
---
|
| 57 |
{plan}
|
|
|
|
| 19 |
# User Inputs
|
| 20 |
age = st.number_input("Age", min_value=10, max_value=100, step=1)
|
| 21 |
gender = st.selectbox("Gender", ["Male", "Female", "Other"])
|
| 22 |
+
goal = st.selectbox(
|
| 23 |
+
"Fitness Goal",
|
| 24 |
+
[
|
| 25 |
+
"Flexibility",
|
| 26 |
+
"Weight Loss",
|
| 27 |
+
"Build Muscle",
|
| 28 |
+
"Strength Gaining",
|
| 29 |
+
"Abs Building"
|
| 30 |
+
]
|
| 31 |
+
)
|
| 32 |
+
fitness_level = st.selectbox(
|
| 33 |
+
"Fitness Level",
|
| 34 |
+
["Beginner", "Intermediate", "Advanced"]
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
equipment = st.multiselect(
|
| 38 |
+
"Available Equipment",
|
| 39 |
+
[
|
| 40 |
+
"Dumbbells",
|
| 41 |
+
"Resistance Band",
|
| 42 |
+
"Yoga Mat",
|
| 43 |
+
"Inclined Bench",
|
| 44 |
+
"Treadmill",
|
| 45 |
+
"Cycle",
|
| 46 |
+
"Skipping Rope",
|
| 47 |
+
"Hand Gripper",
|
| 48 |
+
"Pull-ups Bar",
|
| 49 |
+
"Weight Plates",
|
| 50 |
+
"Hula Hoop Ring",
|
| 51 |
+
"Bosu Ball"
|
| 52 |
+
]
|
| 53 |
+
)
|
| 54 |
|
| 55 |
# Plan Logic
|
| 56 |
|
| 57 |
+
def generate_plan(goal, fitness_level, equipment):
|
| 58 |
plan = ""
|
| 59 |
|
| 60 |
if goal == "Weight Loss":
|
| 61 |
+
plan = "π Focus on calorie-burning workouts with cardio and light strength training."
|
| 62 |
+
elif goal == "Build Muscle":
|
| 63 |
+
plan = "ποΈ Progressive strength training with adequate protein intake."
|
| 64 |
+
elif goal == "Strength Gaining":
|
| 65 |
+
plan = "πͺ Heavy compound lifts with longer rest periods."
|
| 66 |
+
elif goal == "Abs Building":
|
| 67 |
+
plan = "π₯ Core-focused workouts combined with fat-loss strategies."
|
| 68 |
+
else:
|
| 69 |
+
plan = "π§ Flexibility and mobility routines with stretching and yoga."
|
| 70 |
+
|
| 71 |
+
if fitness_level == "Beginner":
|
| 72 |
+
plan += " Start slow, focus on form, and train 3β4 days/week."
|
| 73 |
+
elif fitness_level == "Intermediate":
|
| 74 |
+
plan += " Increase intensity and volume, train 4β5 days/week."
|
| 75 |
else:
|
| 76 |
+
plan += " High-intensity training with structured programming, 5β6 days/week."
|
| 77 |
|
| 78 |
+
if equipment:
|
| 79 |
+
plan += f" Use available equipment: {', '.join(equipment)}."
|
|
|
|
|
|
|
| 80 |
else:
|
| 81 |
+
plan += " Bodyweight exercises will be emphasized."
|
| 82 |
|
| 83 |
return plan
|
| 84 |
|
| 85 |
# Button
|
| 86 |
if st.button("Generate Fitness Plan"):
|
| 87 |
+
plan = generate_plan(goal, fitness_level, equipment)
|
| 88 |
st.success("Your Personalized Fitness Plan")
|
| 89 |
st.markdown(f"""
|
| 90 |
**Age:** {age}
|
| 91 |
**Gender:** {gender}
|
| 92 |
**Goal:** {goal}
|
| 93 |
+
**Fitness Level:** {fitness_level}
|
| 94 |
+
**Equipment:** {', '.join(equipment) if equipment else 'None'}
|
| 95 |
|
| 96 |
---
|
| 97 |
{plan}
|