Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- 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("
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
else:
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 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 |
|