Truong-Phuc commited on
Commit
f614789
1 Parent(s): fcac30c

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +7 -7
Home.py CHANGED
@@ -25,7 +25,7 @@ def convert_prediction(prediction):
25
  else:
26
  return 'L'
27
 
28
- st.title('Demo System for Vietnamese Woman Bra Size Classifier')
29
 
30
  scaler_6, scaler_8, scaler_21, clf_6, clf_8, clf_21 = load_essential_models(scaler_6_path='./Models/6/scaler.pkl', scaler_8_path='./Models/8/scaler.pkl', scaler_full_path='./Models/21/scaler.pkl', clf_6_path='./Models/6/svc_fs_tune.pkl', clf_8_path='./Models/8/ANN_8.h5', clf_full_path='./Models/21/ANNs_full.h5')
31
 
@@ -35,7 +35,7 @@ num_of_features = header_col_1.selectbox(label='Please select the number of meas
35
  # h, w, bmi, vtn, vn, vcn, cn, cnnp, cnnt, cntp, cntt, ccnp, ccnt, snt, sndp, sndt, xup, xut, cl, ttp, ttt = [0.0]*21
36
 
37
  if num_of_features == '6 measurements':
38
- sample_options_6 = header_col_2.selectbox(label='Sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
39
  container_col_1, container_col_2, container_col_3 = st.columns([1, 1, 1])
40
  if sample_options_6 == 'Sample 1 (Small)':
41
  vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=82.00, min_value=0.00, step=0.01)
@@ -60,7 +60,7 @@ if num_of_features == '6 measurements':
60
  ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=471.60, min_value=0.00, step=0.01)
61
 
62
  elif num_of_features == '8 measurements':
63
- sample_options_8 = header_col_2.selectbox(label='Sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
64
  container_col_1, container_col_2, container_col_3, container_col_4 = st.columns([1, 1, 1, 1])
65
  if sample_options_8 == 'Sample 1 (Small)':
66
  ttp = container_col_1.number_input(label='Volume of right breast (cm3):', value=287.50, min_value=0.00, step=0.01)
@@ -90,7 +90,7 @@ elif num_of_features == '8 measurements':
90
  cntp = container_col_3.number_input(label='Inner right breast curve (cm):', value=10.7, min_value=0.00, step=0.01)
91
  vcn = container_col_4.number_input(label='Chest circumference (cm):', value=75.0, min_value=0.00, step=0.01)
92
  else:
93
- sample_options_21 = header_col_2.selectbox(label='Sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
94
  container_col_1, container_col_2, container_col_3, container_col_4, container_col_5 = st.columns([1, 1, 1, 1, 1])
95
  if sample_options_21 == 'Sample 1 (Small)':
96
  h = container_col_1.number_input(label='Height (cm):', value=158.50, min_value=0.00, step=0.01)
@@ -169,14 +169,14 @@ if predict:
169
  X_6 = np.array([[vtn, vn, vcn, cl, ttp, ttt]])
170
  X_6 = scaler_6.transform(X_6)
171
  y_6 = clf_6.predict(X_6)
172
- st.success(f'We recommend you choosing {convert_prediction(y_6)} size!')
173
  elif num_of_features == '8 measurements':
174
  X_8 = np.array([[ttp, cl, cnnp, vn, vtn, cnnt, cntp, vcn]])
175
  X_8 = scaler_8.transform(X_8)
176
  y_8 = clf_8.predict(X_8)
177
- st.success(f'We recommend you choosing {convert_prediction(np.argmax(y_8, axis=1))} size!')
178
  else:
179
  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]])
180
  X_21 = scaler_21.transform(X_21)
181
  y_21 = clf_21.predict(X_21)
182
- st.success(f'We recommend you choosing {convert_prediction(np.argmax(y_21, axis=1))} size!')
 
25
  else:
26
  return 'L'
27
 
28
+ st.markdown("<h1 style='text-align: center;'>Demo System for Vietnamese Woman Bra Size Classifier</h1>", unsafe_allow_html=True)
29
 
30
  scaler_6, scaler_8, scaler_21, clf_6, clf_8, clf_21 = load_essential_models(scaler_6_path='./Models/6/scaler.pkl', scaler_8_path='./Models/8/scaler.pkl', scaler_full_path='./Models/21/scaler.pkl', clf_6_path='./Models/6/svc_fs_tune.pkl', clf_8_path='./Models/8/ANN_8.h5', clf_full_path='./Models/21/ANNs_full.h5')
31
 
 
35
  # h, w, bmi, vtn, vn, vcn, cn, cnnp, cnnt, cntp, cntt, ccnp, ccnt, snt, sndp, sndt, xup, xut, cl, ttp, ttt = [0.0]*21
36
 
37
  if num_of_features == '6 measurements':
38
+ sample_options_6 = header_col_2.selectbox(label='Measurement sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
39
  container_col_1, container_col_2, container_col_3 = st.columns([1, 1, 1])
40
  if sample_options_6 == 'Sample 1 (Small)':
41
  vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=82.00, min_value=0.00, step=0.01)
 
60
  ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=471.60, min_value=0.00, step=0.01)
61
 
62
  elif num_of_features == '8 measurements':
63
+ sample_options_8 = header_col_2.selectbox(label='Measurement sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
64
  container_col_1, container_col_2, container_col_3, container_col_4 = st.columns([1, 1, 1, 1])
65
  if sample_options_8 == 'Sample 1 (Small)':
66
  ttp = container_col_1.number_input(label='Volume of right breast (cm3):', value=287.50, min_value=0.00, step=0.01)
 
90
  cntp = container_col_3.number_input(label='Inner right breast curve (cm):', value=10.7, min_value=0.00, step=0.01)
91
  vcn = container_col_4.number_input(label='Chest circumference (cm):', value=75.0, min_value=0.00, step=0.01)
92
  else:
93
+ sample_options_21 = header_col_2.selectbox(label='Measurement sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
94
  container_col_1, container_col_2, container_col_3, container_col_4, container_col_5 = st.columns([1, 1, 1, 1, 1])
95
  if sample_options_21 == 'Sample 1 (Small)':
96
  h = container_col_1.number_input(label='Height (cm):', value=158.50, min_value=0.00, step=0.01)
 
169
  X_6 = np.array([[vtn, vn, vcn, cl, ttp, ttt]])
170
  X_6 = scaler_6.transform(X_6)
171
  y_6 = clf_6.predict(X_6)
172
+ st.success(f'We recommend you choosing **{convert_prediction(y_6)}** size!')
173
  elif num_of_features == '8 measurements':
174
  X_8 = np.array([[ttp, cl, cnnp, vn, vtn, cnnt, cntp, vcn]])
175
  X_8 = scaler_8.transform(X_8)
176
  y_8 = clf_8.predict(X_8)
177
+ st.success(f'We recommend you choosing **{convert_prediction(np.argmax(y_8, axis=1))}** size!')
178
  else:
179
  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]])
180
  X_21 = scaler_21.transform(X_21)
181
  y_21 = clf_21.predict(X_21)
182
+ st.success(f'We recommend you choosing **{convert_prediction(np.argmax(y_21, axis=1))}** size!')