Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +20 -17
src/streamlit_app.py
CHANGED
|
@@ -166,24 +166,23 @@ if st.button("๐ Submit Profile"):
|
|
| 166 |
bmi_status = bmi_category(bmi)
|
| 167 |
equipment_list = ", ".join(equipment)
|
| 168 |
|
|
|
|
| 169 |
prompt = f"""
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
- Keep it structured day-wise
|
| 186 |
-
"""
|
| 187 |
|
| 188 |
with st.spinner("Generating your AI workout plan..."):
|
| 189 |
response = generator(
|
|
@@ -195,5 +194,9 @@ if st.button("๐ Submit Profile"):
|
|
| 195 |
|
| 196 |
result = response[0]["generated_text"]
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
st.subheader("๐๏ธ Your Personalized Workout Plan")
|
| 199 |
st.write(result)
|
|
|
|
| 166 |
bmi_status = bmi_category(bmi)
|
| 167 |
equipment_list = ", ".join(equipment)
|
| 168 |
|
| 169 |
+
# Improved Prompt
|
| 170 |
prompt = f"""
|
| 171 |
+
You are a certified professional fitness trainer.
|
| 172 |
+
|
| 173 |
+
Create a detailed 5-day workout plan.
|
| 174 |
+
|
| 175 |
+
User Information:
|
| 176 |
+
- Gender: {gender}
|
| 177 |
+
- BMI: {bmi:.2f} ({bmi_status})
|
| 178 |
+
- Goal: {goal}
|
| 179 |
+
- Fitness Level: {fitness_level}
|
| 180 |
+
- Equipment Available: {equipment_list}
|
| 181 |
+
|
| 182 |
+
Start directly with:
|
| 183 |
+
|
| 184 |
+
Day 1:
|
| 185 |
+
"""
|
|
|
|
|
|
|
| 186 |
|
| 187 |
with st.spinner("Generating your AI workout plan..."):
|
| 188 |
response = generator(
|
|
|
|
| 194 |
|
| 195 |
result = response[0]["generated_text"]
|
| 196 |
|
| 197 |
+
# Remove prompt if model repeats it
|
| 198 |
+
if result.startswith(prompt):
|
| 199 |
+
result = result[len(prompt):].strip()
|
| 200 |
+
|
| 201 |
st.subheader("๐๏ธ Your Personalized Workout Plan")
|
| 202 |
st.write(result)
|