srustik123 commited on
Commit
d8601c9
·
verified ·
1 Parent(s): 3fb4b2b

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +10 -3
src/streamlit_app.py CHANGED
@@ -29,7 +29,7 @@ def get_category(bmi):
29
  @st.cache_resource
30
  def load_model():
31
  return pipeline(
32
- "text-generation",
33
  model="google/flan-t5-base"
34
  )
35
 
@@ -40,6 +40,7 @@ generator = load_model()
40
  # -------------------------
41
  st.title("💪 FitPlan-AI: Personalized Fitness Profile")
42
 
 
43
  with st.form("fitness_form"):
44
 
45
  st.subheader("Personal Information")
@@ -62,9 +63,14 @@ with st.form("fitness_form"):
62
  ["Dumbbells", "Resistance Band", "Yoga Mat", "No Equipment", "Kettlebell", "Pull-up Bar"]
63
  )
64
 
65
- submit = st.form_submit_button("Generate Workout Plan")
 
 
 
66
 
67
- # ✅ ALL LOGIC INSIDE FORM
 
 
68
  if submit:
69
  # Validation
70
  if not name.strip():
@@ -84,6 +90,7 @@ with st.form("fitness_form"):
84
 
85
  equipment_list = ", ".join(equipment)
86
 
 
87
  prompt = f"""
88
  Create a professional 5-day structured workout plan.
89
  User Details:
 
29
  @st.cache_resource
30
  def load_model():
31
  return pipeline(
32
+ "text2text-generation", # Correct for FLAN-T5
33
  model="google/flan-t5-base"
34
  )
35
 
 
40
  # -------------------------
41
  st.title("💪 FitPlan-AI: Personalized Fitness Profile")
42
 
43
+ # Form to collect all inputs
44
  with st.form("fitness_form"):
45
 
46
  st.subheader("Personal Information")
 
63
  ["Dumbbells", "Resistance Band", "Yoga Mat", "No Equipment", "Kettlebell", "Pull-up Bar"]
64
  )
65
 
66
+ # -------------------------
67
+ # SUBMIT BUTTON AT BOTTOM
68
+ # -------------------------
69
+ submit = st.form_submit_button("Submit Profile")
70
 
71
+ # -------------------------
72
+ # HANDLE SUBMISSION
73
+ # -------------------------
74
  if submit:
75
  # Validation
76
  if not name.strip():
 
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: