Truong-Phuc Nguyen commited on
Commit
603cf5e
1 Parent(s): bb558c1

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +9 -6
Home.py CHANGED
@@ -19,11 +19,11 @@ def load_essential_models(scaler_6_path, scaler_8_path, scaler_full_path, clf_6_
19
 
20
  def convert_prediction(prediction):
21
  if (prediction[0] == [0]):
22
- return 'S'
23
  elif (prediction[0] == [1]):
24
- return 'M'
25
  else:
26
- return 'L'
27
 
28
  st.markdown("<h1 style='text-align: center;'>Vietnamese Woman Bra Size Classifier</h1>", unsafe_allow_html=True)
29
 
@@ -171,7 +171,8 @@ if predict:
171
  y_6 = clf_6.predict(X_6)
172
  st.success(y_6)
173
  y_pred_6 = convert_prediction(y_6)
174
- styled_text = f"<h3 style='text-align: center;'>We recommend you choosing <span style='color: red; font-weight: bold;'>{y_pred_6}</span> size!</h3>"
 
175
  st.markdown(styled_text, unsafe_allow_html=True)
176
 
177
  elif num_of_features == '8 measurements':
@@ -179,12 +180,14 @@ if predict:
179
  X_8 = scaler_8.transform(X_8)
180
  y_8 = clf_8.predict(X_8)
181
  y_pred_8 = convert_prediction(np.argmax(y_8, axis=1))
182
- styled_text = f"<h3 style='text-align: center;'>We recommend you choosing <span style='color: red; font-weight: bold;'>{y_pred_8}</span> size!</h3>"
 
183
  st.markdown(styled_text, unsafe_allow_html=True)
184
  else:
185
  X_21 = np.array([[h, w, bmi, vtn, vn, vcn, cn, cnnp, cnnt, cntp, cntt, ccnp, ccnt, snt, sndp, sndt, xup, xut, cl, ttp, ttt]])
186
  X_21 = scaler_21.transform(X_21)
187
  y_21 = clf_21.predict(X_21)
188
  y_pred_21 = convert_prediction(np.argmax(y_21, axis=1))
189
- styled_text = f"<h3 style='text-align: center;'>We recommend you choosing <span style='color: red; font-weight: bold;'>{y_pred_21}</span> size!</h3>"
 
190
  st.markdown(styled_text, unsafe_allow_html=True)
 
19
 
20
  def convert_prediction(prediction):
21
  if (prediction[0] == [0]):
22
+ return 'the small breast group'
23
  elif (prediction[0] == [1]):
24
+ return 'the medium breast group'
25
  else:
26
+ return 'the large breast group'
27
 
28
  st.markdown("<h1 style='text-align: center;'>Vietnamese Woman Bra Size Classifier</h1>", unsafe_allow_html=True)
29
 
 
171
  y_6 = clf_6.predict(X_6)
172
  st.success(y_6)
173
  y_pred_6 = convert_prediction(y_6)
174
+ # styled_text = f"<h3 style='text-align: center;'>We recommend you choosing <span style='color: red; font-weight: bold;'>{y_pred_6}</span> size!</h3>"
175
+ styled_text = f"<h3 style='text-align: center;'>You belong to <span style='color: red; font-weight: bold;'>{y_pred_6}</span> !</h3>"
176
  st.markdown(styled_text, unsafe_allow_html=True)
177
 
178
  elif num_of_features == '8 measurements':
 
180
  X_8 = scaler_8.transform(X_8)
181
  y_8 = clf_8.predict(X_8)
182
  y_pred_8 = convert_prediction(np.argmax(y_8, axis=1))
183
+ # styled_text = f"<h3 style='text-align: center;'>We recommend you choosing <span style='color: red; font-weight: bold;'>{y_pred_8}</span> size!</h3>"
184
+ styled_text = f"<h3 style='text-align: center;'>You belong to <span style='color: red; font-weight: bold;'>{y_pred_8}</span> !</h3>"
185
  st.markdown(styled_text, unsafe_allow_html=True)
186
  else:
187
  X_21 = np.array([[h, w, bmi, vtn, vn, vcn, cn, cnnp, cnnt, cntp, cntt, ccnp, ccnt, snt, sndp, sndt, xup, xut, cl, ttp, ttt]])
188
  X_21 = scaler_21.transform(X_21)
189
  y_21 = clf_21.predict(X_21)
190
  y_pred_21 = convert_prediction(np.argmax(y_21, axis=1))
191
+ # styled_text = f"<h3 style='text-align: center;'>We recommend you choosing <span style='color: red; font-weight: bold;'>{y_pred_21}</span> size!</h3>"
192
+ styled_text = f"<h3 style='text-align: center;'>You belong to <span style='color: red; font-weight: bold;'>{y_pred_21}</span> !</h3>"
193
  st.markdown(styled_text, unsafe_allow_html=True)