Springboardmen commited on
Commit
ca6052a
ยท
verified ยท
1 Parent(s): 981cd12

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. 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
- Generate a 5-day structured workout plan.
171
-
172
- User Details:
173
- Name: {name}
174
- Gender: {gender}
175
- BMI: {bmi:.2f} ({bmi_status})
176
- Goal: {goal}
177
- Fitness Level: {fitness_level}
178
- Available Equipment: {equipment_list}
179
-
180
- Requirements:
181
- - Include warmup
182
- - Include exercises with sets and reps
183
- - Include rest time
184
- - Adjust intensity based on BMI and fitness level
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)