Shrey0405 commited on
Commit
bf20139
·
verified ·
1 Parent(s): bb899c1

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +6 -6
src/streamlit_app.py CHANGED
@@ -1,5 +1,5 @@
1
  import streamlit as st
2
- import transformers # Changed the way we import to check for errors
3
  from transformers import pipeline
4
 
5
  # --- Page Config ---
@@ -23,7 +23,7 @@ if 'user_data' not in st.session_state:
23
  if 'profile_complete' not in st.session_state:
24
  st.session_state.profile_complete = False
25
 
26
- # --- Helper Functions ---
27
  def calculate_bmi(w, h_cm):
28
  if h_cm > 0:
29
  return round(w / ((h_cm / 100) ** 2), 2)
@@ -36,7 +36,7 @@ def bmi_category(bmi):
36
  if bmi < 30: return "Overweight"
37
  return "Obese"
38
 
39
- # --- Mam's Code: Model Loading ---
40
  @st.cache_resource
41
  def load_model():
42
  # Using text-generation as per the environment's supported list
@@ -66,7 +66,7 @@ if menu == "👤 Profile":
66
 
67
  bmi = calculate_bmi(u_weight, u_height)
68
 
69
- # --- Mam's Code: Submit Button & Validation ---
70
  if st.button("Submit Profile"):
71
 
72
  if not name:
@@ -87,7 +87,7 @@ if menu == "👤 Profile":
87
  bmi_status = bmi_category(bmi)
88
  equipment_list = ", ".join(equipment)
89
 
90
- # Mam's Code: Prompt
91
  prompt = f"""
92
  Generate a 5-day structured workout plan.
93
 
@@ -108,7 +108,7 @@ if menu == "👤 Profile":
108
  """
109
 
110
  with st.spinner("Generating your AI workout plan..."):
111
- # Mam's Code: Generator call
112
  result = generator(prompt, max_new_tokens=400)[0]["generated_text"]
113
 
114
  st.subheader("🏋️ Your Personalized Workout Plan")
 
1
  import streamlit as st
2
+ import transformers
3
  from transformers import pipeline
4
 
5
  # --- Page Config ---
 
23
  if 'profile_complete' not in st.session_state:
24
  st.session_state.profile_complete = False
25
 
26
+ # --- Functions ---
27
  def calculate_bmi(w, h_cm):
28
  if h_cm > 0:
29
  return round(w / ((h_cm / 100) ** 2), 2)
 
36
  if bmi < 30: return "Overweight"
37
  return "Obese"
38
 
39
+ # - ---
40
  @st.cache_resource
41
  def load_model():
42
  # Using text-generation as per the environment's supported list
 
66
 
67
  bmi = calculate_bmi(u_weight, u_height)
68
 
69
+ # ---
70
  if st.button("Submit Profile"):
71
 
72
  if not name:
 
87
  bmi_status = bmi_category(bmi)
88
  equipment_list = ", ".join(equipment)
89
 
90
+ # Prompt
91
  prompt = f"""
92
  Generate a 5-day structured workout plan.
93
 
 
108
  """
109
 
110
  with st.spinner("Generating your AI workout plan..."):
111
+
112
  result = generator(prompt, max_new_tokens=400)[0]["generated_text"]
113
 
114
  st.subheader("🏋️ Your Personalized Workout Plan")