srbhavya01 commited on
Commit
bd5ab6a
·
verified ·
1 Parent(s): 4ee72e1

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +40 -20
src/streamlit_app.py CHANGED
@@ -67,25 +67,45 @@ def bmi_category(bmi):
67
  # Submit Button
68
  # -------------------------
69
 
70
- if st.button("Calculate BMI"):
71
-
72
- # Validation
73
- if not name or height_cm <= 0 or weight_kg <= 0:
74
- st.error("⚠ Please fill all required fields with valid values!")
 
 
 
 
 
 
75
  else:
76
- bmi = calculate_bmi(weight_kg, height_cm)
77
- category = bmi_category(bmi)
78
-
79
- st.success("✅ Calculation Successful!")
80
-
81
- st.write(f"### 👤 Name: {name}")
82
- st.write(f"### 📊 Your BMI: {bmi}")
83
- st.write(f"### 🏷 BMI Category: {category}")
84
-
85
- st.write("---")
86
- st.write("### 🏋 Fitness Summary")
87
- st.write(f"**Goal:** {goal}")
88
- st.write(f"**Fitness Level:** {fitness_level}")
89
- st.write(f"**Equipment Available:** {', '.join(equipment) if equipment else 'None selected'}")
90
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
 
67
  # Submit Button
68
  # -------------------------
69
 
70
+ if st.button("Submit Profile"):
71
+
72
+ if not name:
73
+ st.error("Please enter your name.")
74
+
75
+ elif not equipment:
76
+ st.error("Please select at least one equipment option.")
77
+
78
+ elif bmi is None:
79
+ st.error("Please enter valid height and weight.")
80
+
81
  else:
82
+ st.success("✅ Profile Submitted Successfully!")
83
+
84
+ bmi_status = bmi_category(bmi)
85
+ equipment_list = ", ".join(equipment)
86
+
87
+ prompt = f"""
88
+ Generate a 5-day structured workout plan.
89
+
90
+ User Details:
91
+ Name: {name}
92
+ Gender: {gender}
93
+ BMI: {bmi:.2f} ({bmi_status})
94
+ Goal: {goal}
95
+ Fitness Level: {fitness_level}
96
+ Available Equipment: {equipment_list}
97
+
98
+ Requirements:
99
+ - Include warmup
100
+ - Include exercises with sets and reps
101
+ - Include rest time
102
+ - Adjust intensity based on BMI and fitness level
103
+ - Keep it structured day-wise
104
+ """
105
+
106
+ with st.spinner("Generating your AI workout plan..."):
107
+ result = generator(prompt, max_new_tokens=400)[0]["generated_text"]
108
+
109
+ st.subheader("🏋️ Your Personalized Workout Plan")
110
+ st.write(result)
111