srustik123 commited on
Commit
d8b0f81
·
verified ·
1 Parent(s): 6091967

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -48
app.py CHANGED
@@ -95,58 +95,37 @@ if submit:
95
 
96
  st.write(f"### 📊 Your BMI: {bmi} ({bmi_status})")
97
 
98
- equipment_list = ", ".join(equipment)
99
-
100
  # -------------------------
101
- # GENERATE 5-DAY PLAN (LOOP METHOD)
102
  # -------------------------
103
- with st.spinner("Generating your 5-day workout plan..."):
104
-
105
- from prompt_builder import build_prompt
106
-
107
- with st.spinner("Generating your 5-day workout plan..."):
108
-
109
- prompt, bmi, bmi_status = build_prompt(
110
- name=name,
111
- gender="Not specified", # or add gender field in form
112
- height=height,
113
- weight=weight,
114
- goal=goal,
115
- fitness_level=level,
116
- equipment=equipment
117
- )
118
-
119
- inputs = tokenizer(prompt, return_tensors="pt", truncation=True)
120
 
121
- outputs = model.generate(
122
- **inputs,
123
- max_new_tokens=800, # increase token limit
124
- temperature=0.7,
125
- do_sample=True,
126
- repetition_penalty=1.1
127
- )
128
-
129
- full_plan = tokenizer.decode(
130
- outputs[0],
131
- skip_special_tokens=True
132
- ).strip()
133
-
134
- inputs = tokenizer(prompt, return_tensors="pt", truncation=True)
135
-
136
- outputs = model.generate(
137
- **inputs,
138
- max_new_tokens=350,
139
- temperature=0.8,
140
- do_sample=True,
141
- repetition_penalty=1.1
142
- )
143
-
144
- result = tokenizer.decode(
145
- outputs[0],
146
- skip_special_tokens=True
147
- ).strip()
148
 
149
- full_plan += result + "\n\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  # -------------------------
152
  # DISPLAY PLAN
 
95
 
96
  st.write(f"### 📊 Your BMI: {bmi} ({bmi_status})")
97
 
 
 
98
  # -------------------------
99
+ # GENERATE 5-DAY PLAN (SINGLE PROMPT METHOD)
100
  # -------------------------
101
+ from prompt_builder import build_prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
+ with st.spinner("Generating your 5-day workout plan..."):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
+ prompt, bmi, bmi_status = build_prompt(
106
+ name=name,
107
+ gender="Not specified", # You can add gender field later
108
+ height=height,
109
+ weight=weight,
110
+ goal=goal,
111
+ fitness_level=level,
112
+ equipment=equipment
113
+ )
114
+
115
+ inputs = tokenizer(prompt, return_tensors="pt", truncation=True)
116
+
117
+ outputs = model.generate(
118
+ **inputs,
119
+ max_new_tokens=800,
120
+ temperature=0.7,
121
+ do_sample=True,
122
+ repetition_penalty=1.1
123
+ )
124
+
125
+ full_plan = tokenizer.decode(
126
+ outputs[0],
127
+ skip_special_tokens=True
128
+ ).strip()
129
 
130
  # -------------------------
131
  # DISPLAY PLAN