srbhavya01 commited on
Commit
952882a
Β·
verified Β·
1 Parent(s): 7988dd2

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. 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("Fitness Goal", ["Weight Loss", "Muscle Gain", "General Fitness"])
23
- activity = st.selectbox("Activity Level", ["Low", "Medium", "High"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  # Plan Logic
26
 
27
- def generate_plan(age, goal, activity):
28
  plan = ""
29
 
30
  if goal == "Weight Loss":
31
- plan = "πŸƒ Cardio 4–5 days/week, strength training 2–3 days/week, calorie-controlled diet."
32
- elif goal == "Muscle Gain":
33
- plan = "πŸ‹οΈ Strength training 4–5 days/week, high-protein diet, proper sleep and recovery."
 
 
 
 
 
 
 
 
 
 
 
34
  else:
35
- plan = "🀸 Combination of cardio & strength training 3–4 days/week, balanced nutrition."
36
 
37
- if activity == "Low":
38
- plan += " Start with light intensity and gradually increase."
39
- elif activity == "Medium":
40
- plan += " Maintain moderate intensity workouts."
41
  else:
42
- plan += " Include high-intensity workouts with proper rest days."
43
 
44
  return plan
45
 
46
  # Button
47
  if st.button("Generate Fitness Plan"):
48
- plan = generate_plan(age, goal, activity)
49
  st.success("Your Personalized Fitness Plan")
50
  st.markdown(f"""
51
  **Age:** {age}
52
  **Gender:** {gender}
53
  **Goal:** {goal}
54
- **Activity Level:** {activity}
 
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}