srustik123 commited on
Commit
f6f909d
·
verified ·
1 Parent(s): 114c23e

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +40 -40
src/streamlit_app.py CHANGED
@@ -72,43 +72,43 @@ with st.form("fitness_form"):
72
  # HANDLE SUBMISSION
73
  # -------------------------
74
  if submit:
75
- # Validation
76
- if not full name.strip():
77
- st.error("Please enter your name.")
78
- elif height <= 0 or weight <= 0:
79
- st.error("Height and Weight must be positive values.")
80
- elif not availabelequipment:
81
- st.error("Please select at least one equipment option.")
82
- else:
83
- # Calculate BMI
84
- user_bmi = calculate_bmi(weight, height)
85
- bmi_status = get_category(user_bmi)
86
-
87
- st.success(f"✅ Profile Created Successfully for {name}!")
88
- st.metric("Your BMI", user_bmi)
89
- st.info(f"Health Category: **{bmi_status}**")
90
-
91
- equipment_list = ", ".join(equipment)
92
-
93
- # Prepare AI prompt
94
- prompt = f"""
95
- Create a professional 5-day structured workout plan.
96
- User Details:
97
- Name: {name}
98
- BMI: {user_bmi} ({bmi_status})
99
- Goal: {goal}
100
- Fitness Level: {level}
101
- Equipment: {equipment_list}
102
- Include:
103
- - Warm-up
104
- - Exercises with sets and reps
105
- - Rest time
106
- - Intensity adjustment
107
- - Day-wise structure
108
- """
109
-
110
- with st.spinner("Generating your AI workout plan..."):
111
- result = generator(prompt, max_new_tokens=400)[0]["generated_text"]
112
-
113
- st.subheader("🏋️ Your Personalized Workout Plan")
114
- st.write(result)
 
72
  # HANDLE SUBMISSION
73
  # -------------------------
74
  if submit:
75
+ # Validation
76
+ if not name.strip():
77
+ st.error("Please enter your name.")
78
+ elif height <= 0 or weight <= 0:
79
+ st.error("Height and Weight must be positive values.")
80
+ elif not equipment:
81
+ st.error("Please select at least one equipment option.")
82
+ else:
83
+ # Calculate BMI
84
+ user_bmi = calculate_bmi(weight, height)
85
+ bmi_status = get_category(user_bmi)
86
+
87
+ st.success(f"✅ Profile Created Successfully for {name}!")
88
+ st.metric("Your BMI", user_bmi)
89
+ st.info(f"Health Category: **{bmi_status}**")
90
+
91
+ equipment_list = ", ".join(equipment)
92
+
93
+ # Prepare AI prompt
94
+ prompt = f"""
95
+ Create a professional 5-day structured workout plan.
96
+ User Details:
97
+ Name: {name}
98
+ BMI: {user_bmi} ({bmi_status})
99
+ Goal: {goal}
100
+ Fitness Level: {level}
101
+ Equipment: {equipment_list}
102
+ Include:
103
+ - Warm-up
104
+ - Exercises with sets and reps
105
+ - Rest time
106
+ - Intensity adjustment
107
+ - Day-wise structure
108
+ """
109
+
110
+ with st.spinner("Generating your AI workout plan..."):
111
+ result = generator(prompt, max_new_tokens=400)[0]["generated_text"]
112
+
113
+ st.subheader("🏋️ Your Personalized Workout Plan")
114
+ st.write(result)