Truong-Phuc Nguyen commited on
Commit
a3a53e1
1 Parent(s): 35d09c3

Upload 9 files

Browse files

Vietnamese Woman Bra Size Classifier by n.t.phuc149
Version: v1.0

.streamlit/config.toml ADDED
@@ -0,0 +1 @@
 
 
1
+ [theme]
Models/21/ANNs_full.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2171b1124533345a97d16e6a4c7175d14f4a30c68e4f7d2d88e0ee7bebe99d1
3
+ size 2151608
Models/21/scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bba338e5a9e948bcb24eeae5564b38b3f357ddf003b319120b4d9e805049247
3
+ size 1167
Models/6/scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:112f1f7423b966cb0262c61e3cfe06bb587fbc8a4573f120e025137d2fa219cf
3
+ size 842
Models/6/svc_fs_tune.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dbcd2543e3b001c0463ae9287023bd4ddfb7fe4309359aec1fa458040b2f32c8
3
+ size 25810
Models/8/ANNs_8base.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec6d4f39c2b589d0d9b7d9f9a7c4d20f257d5fbb298d2257f720c63d073728d0
3
+ size 2075968
Models/8/scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72a59613ba32e5f133a958bd1bd30770b992ad45f9e48ebee0c37a90997fd2e7
3
+ size 777
app.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ import numpy as np
3
+ import streamlit as st
4
+ from tensorflow.keras.models import load_model
5
+
6
+ def load_essential_models(scaler_6_path, scaler_8_path, scaler_full_path, clf_6_path, clf_8_path, clf_full_path):
7
+ scaler_6 = pickle.load(open(file=scaler_6_path, mode='rb'))
8
+ scaler_8 = pickle.load(open(file=scaler_8_path, mode='rb'))
9
+ scaler_21 = pickle.load(open(file=scaler_full_path, mode='rb'))
10
+ clf_6 = pickle.load(open(file=clf_6_path, mode='rb'))
11
+ clf_8 = load_model(clf_8_path)
12
+ clf_21 = load_model(clf_full_path)
13
+ return scaler_6, scaler_8, scaler_21, clf_6, clf_8, clf_21
14
+
15
+ 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/ANNs_8base.h5', clf_full_path='./Models/21/ANNs_full.h5')
16
+
17
+ st.title('Demo System for Vietnamese Woman Bra Size Classifier')
18
+
19
+ header_col_1, header_col_2 = st.columns([3, 2])
20
+ num_of_features = header_col_1.selectbox(label='Please select the number of measurements you have:', options=['6 measurements', '8 measurements', '21 measurements'])
21
+
22
+ h, w, bmi, vtn, vn, vcn, cn, cnnp, cnnt, cntp, cntt, ccnp, ccnt, snt, sndp, sndt, xup, xut, cl, ttp, ttt = [0.0]*21
23
+
24
+ if num_of_features == '6 measurements':
25
+ sample_options_6 = header_col_2.selectbox(label='Sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
26
+ container_col_1, container_col_2, container_col_3 = st.columns([1, 1, 1])
27
+ if sample_options_6 == 'Sample 1 (Small)':
28
+ vtn = container_col_1.number_input(label='Your vtn: ', value=82.00, min_value=0.00, step=0.01)
29
+ vn = container_col_2.number_input(label='Your vn:', value=82.40, min_value=0.00, step=0.01)
30
+ vcn = container_col_3.number_input(label='Your vcn:', value=73.10, min_value=0.00, step=0.01)
31
+ cl = container_col_1.number_input(label='Your cl:', value=9.30, min_value=0.00, step=0.01)
32
+ ttp = container_col_2.number_input(label='Your ttp:', value=325.6, min_value=0.00, step=0.01)
33
+ ttt = container_col_3.number_input(label='Your ttt:', value=325.6, min_value=0.00, step=0.01)
34
+ elif sample_options_6 == 'Sample 2 (Medium)':
35
+ vtn = container_col_1.number_input(label='Your vtn: ', value=77.20, min_value=0.00, step=0.01)
36
+ vn = container_col_2.number_input(label='Your vn:', value=78.60, min_value=0.00, step=0.01)
37
+ vcn = container_col_3.number_input(label='Your vcn:', value=66.50, min_value=0.00, step=0.01)
38
+ cl = container_col_1.number_input(label='Your cl:', value=12.10, min_value=0.00, step=0.01)
39
+ ttp = container_col_2.number_input(label='Your ttp:', value=388.80, min_value=0.00, step=0.01)
40
+ ttt = container_col_3.number_input(label='Your ttt:', value=324.60, min_value=0.00, step=0.01)
41
+ else:
42
+ vtn = container_col_1.number_input(label='Your vtn: ', value=86.50, min_value=0.00, step=0.01)
43
+ vn = container_col_2.number_input(label='Your vn:', value=88.00, min_value=0.00, step=0.01)
44
+ vcn = container_col_3.number_input(label='Your vcn:', value=74.00, min_value=0.00, step=0.01)
45
+ cl = container_col_1.number_input(label='Your cl:', value=14.00, min_value=0.00, step=0.01)
46
+ ttp = container_col_2.number_input(label='Your ttp:', value=451.30, min_value=0.00, step=0.01)
47
+ ttt = container_col_3.number_input(label='Your ttt:', value=471.60, min_value=0.00, step=0.01)
48
+
49
+ elif num_of_features == '8 measurements':
50
+ sample_options_8 = header_col_2.selectbox(label='Sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
51
+ container_col_1, container_col_2, container_col_3, container_col_4 = st.columns([1, 1, 1, 1])
52
+ if sample_options_8 == 'Sample 1 (Small)':
53
+ ttp = container_col_1.number_input(label='Your ttp:', value=325.10, min_value=0.00, step=0.01)
54
+ cl = container_col_2.number_input(label='Your cl:', value=8.90, min_value=0.00, step=0.01)
55
+ cnnp = container_col_3.number_input(label='Your cnnp:', value=12.30, min_value=0.00, step=0.01)
56
+ vn = container_col_4.number_input(label='Your vn:', value=83.20, min_value=0.00, step=0.01)
57
+ vtn = container_col_1.number_input(label='Your vtn: ', value=80.10, min_value=0.00, step=0.01)
58
+ ccnt = container_col_2.number_input(label='Your ccnt:', value=11.10, min_value=0.00, step=0.01)
59
+ cntp = container_col_3.number_input(label='Your cntp:', value=8.70, min_value=0.00, step=0.01)
60
+ vcn = container_col_4.number_input(label='Your vcn:', value=74.30, min_value=0.00, step=0.01)
61
+ elif sample_options_8 == 'Sample 2 (Medium)':
62
+ ttp = container_col_1.number_input(label='Your ttp:', value=385.80, min_value=0.00, step=0.01)
63
+ cl = container_col_2.number_input(label='Your cl:', value=13.60, min_value=0.00, step=0.01)
64
+ cnnp = container_col_3.number_input(label='Your cnnp:', value=8.80, min_value=0.00, step=0.01)
65
+ vn = container_col_4.number_input(label='Your vn:', value=83.20, min_value=0.00, step=0.01)
66
+ vtn = container_col_1.number_input(label='Your vtn: ', value=82.50, min_value=0.00, step=0.01)
67
+ ccnt = container_col_2.number_input(label='Your ccnt:', value=9.30, min_value=0.00, step=0.01)
68
+ cntp = container_col_3.number_input(label='Your cntp:', value=9.10, min_value=0.00, step=0.01)
69
+ vcn = container_col_4.number_input(label='Your vcn:', value=69.60, min_value=0.00, step=0.01)
70
+ else:
71
+ ttp = container_col_1.number_input(label='Your ttp:', value=453.30, min_value=0.00, step=0.01)
72
+ cl = container_col_2.number_input(label='Your cl:', value=13.00, min_value=0.00, step=0.01)
73
+ cnnp = container_col_3.number_input(label='Your cnnp:', value=12.50, min_value=0.00, step=0.01)
74
+ vn = container_col_4.number_input(label='Your vn:', value=85.30, min_value=0.00, step=0.01)
75
+ vtn = container_col_1.number_input(label='Your vtn: ', value=78.50, min_value=0.00, step=0.01)
76
+ ccnt = container_col_2.number_input(label='Your ccnt:', value=12.40, min_value=0.00, step=0.01)
77
+ cntp = container_col_3.number_input(label='Your cntp:', value=10.00, min_value=0.00, step=0.01)
78
+ vcn = container_col_4.number_input(label='Your vcn:', value=72.30, min_value=0.00, step=0.01)
79
+ else:
80
+ sample_options_21 = header_col_2.selectbox(label='Sample options:', options=['Sample 1 (Small)', 'Sample 2 (Medium)', 'Sample 3 (Large)'])
81
+ container_col_1, container_col_2, container_col_3, container_col_4, container_col_5 = st.columns([1, 1, 1, 1, 1])
82
+ if sample_options_21 == 'Sample 1 (Small)':
83
+ h = container_col_1.number_input(label='Your h:', value=158.50, min_value=0.00, step=0.01)
84
+ w = container_col_2.number_input(label='Your w:', value=44.00, min_value=0.00, step=0.01)
85
+ bmi = container_col_3.number_input(label='Your bmi:', value=17.50, min_value=0.00, step=0.01)
86
+ vtn = container_col_4.number_input(label='Your vtn: ', value=75.40, min_value=0.00, step=0.01)
87
+ vn = container_col_5.number_input(label='Your vn:', value=81.10, min_value=0.00, step=0.01)
88
+ vcn = container_col_1.number_input(label='Your vcn:', value=74.80, min_value=0.00, step=0.01)
89
+ cn = container_col_2.number_input(label='Your cn:', value=14.50, min_value=0.00, step=0.01)
90
+ cnnp = container_col_3.number_input(label='Your cnnp:', value=13.80, min_value=0.00, step=0.01)
91
+ cnnt = container_col_4.number_input(label='Your cnnt:', value=14.40, min_value=0.00, step=0.01)
92
+ cntp = container_col_5.number_input(label='Your cntp:', value=8.60, min_value=0.00, step=0.01)
93
+ cntt = container_col_1.number_input(label='Your cntt:', value=8.40, min_value=0.00, step=0.01)
94
+ ccnp = container_col_2.number_input(label='Your ccnp:', value=21.50, min_value=0.00, step=0.01)
95
+ ccnt = container_col_3.number_input(label='Your ccnt:', value=21.20, min_value=0.00, step=0.01)
96
+ snt = container_col_4.number_input(label='Your snt:', value=8.90, min_value=0.00, step=0.01)
97
+ sndp = container_col_5.number_input(label='Your sndp:', value=6.50, min_value=0.00, step=0.01)
98
+ sndt = container_col_1.number_input(label='Your sndt:', value=6.50, min_value=0.00, step=0.01)
99
+ xup = container_col_2.number_input(label='Your xup:', value=21.80, min_value=0.00, step=0.01)
100
+ xut = container_col_3.number_input(label='Your xut:', value=21.10, min_value=0.00, step=0.01)
101
+ cl = container_col_4.number_input(label='Your cl:', value=6.30, min_value=0.00, step=0.01)
102
+ ttp = container_col_5.number_input(label='Your ttp:', value=325.10, min_value=0.00, step=0.01)
103
+ ttt = container_col_3.number_input(label='Your ttt:', value=335.70, min_value=0.00, step=0.01)
104
+ elif sample_options_21 == 'Sample 2 (Medium)':
105
+ h = container_col_1.number_input(label='Your h:', value=163.00, min_value=0.00, step=0.01)
106
+ w = container_col_2.number_input(label='Your w:', value=43.00, min_value=0.00, step=0.01)
107
+ bmi = container_col_3.number_input(label='Your bmi:', value=16.20, min_value=0.00, step=0.01)
108
+ vtn = container_col_4.number_input(label='Your vtn: ', value=76.00, min_value=0.00, step=0.01)
109
+ vn = container_col_5.number_input(label='Your vn:', value=79.00, min_value=0.00, step=0.01)
110
+ vcn = container_col_1.number_input(label='Your vcn:', value=64.00, min_value=0.00, step=0.01)
111
+ cn = container_col_2.number_input(label='Your cn:', value=16.50, min_value=0.00, step=0.01)
112
+ cnnp = container_col_3.number_input(label='Your cnnp:', value=13.10, min_value=0.00, step=0.01)
113
+ cnnt = container_col_4.number_input(label='Your cnnt:', value=12.60, min_value=0.00, step=0.01)
114
+ cntp = container_col_5.number_input(label='Your cntp:', value=9.20, min_value=0.00, step=0.01)
115
+ cntt = container_col_1.number_input(label='Your cntt:', value=9.10, min_value=0.00, step=0.01)
116
+ ccnp = container_col_2.number_input(label='Your ccnp:', value=19.80, min_value=0.00, step=0.01)
117
+ ccnt = container_col_3.number_input(label='Your ccnt:', value=18.20, min_value=0.00, step=0.01)
118
+ snt = container_col_4.number_input(label='Your snt:', value=8.40, min_value=0.00, step=0.01)
119
+ sndp = container_col_5.number_input(label='Your sndp:', value=3.50, min_value=0.00, step=0.01)
120
+ sndt = container_col_1.number_input(label='Your sndt:', value=3.70, min_value=0.00, step=0.01)
121
+ xup = container_col_2.number_input(label='Your xup:', value=21.00, min_value=0.00, step=0.01)
122
+ xut = container_col_3.number_input(label='Your xut:', value=20.50, min_value=0.00, step=0.01)
123
+ cl = container_col_4.number_input(label='Your cl:', value=15.00, min_value=0.00, step=0.01)
124
+ ttp = container_col_5.number_input(label='Your ttp:', value=521.60, min_value=0.00, step=0.01)
125
+ ttt = container_col_3.number_input(label='Your ttt:', value=513.50, min_value=0.00, step=0.01)
126
+ else:
127
+ h = container_col_1.number_input(label='Your h:', value=152.00, min_value=0.00, step=0.01)
128
+ w = container_col_2.number_input(label='Your w:', value=46.00, min_value=0.00, step=0.01)
129
+ bmi = container_col_3.number_input(label='Your bmi:', value=19.90, min_value=0.00, step=0.01)
130
+ vtn = container_col_4.number_input(label='Your vtn: ', value=77.50, min_value=0.00, step=0.01)
131
+ vn = container_col_5.number_input(label='Your vn:', value=85.50, min_value=0.00, step=0.01)
132
+ vcn = container_col_1.number_input(label='Your vcn:', value=70.40, min_value=0.00, step=0.01)
133
+ cn = container_col_2.number_input(label='Your cn:', value=18.90, min_value=0.00, step=0.01)
134
+ cnnp = container_col_3.number_input(label='Your cnnp:', value=13.50, min_value=0.00, step=0.01)
135
+ cnnt = container_col_4.number_input(label='Your cnnt:', value=12.50, min_value=0.00, step=0.01)
136
+ cntp = container_col_5.number_input(label='Your cntp:', value=10.30, min_value=0.00, step=0.01)
137
+ cntt = container_col_1.number_input(label='Your cntt:', value=10.50, min_value=0.00, step=0.01)
138
+ ccnp = container_col_2.number_input(label='Your ccnp:', value=20.40, min_value=0.00, step=0.01)
139
+ ccnt = container_col_3.number_input(label='Your ccnt:', value=20.10, min_value=0.00, step=0.01)
140
+ snt = container_col_4.number_input(label='Your snt:', value=8.50, min_value=0.00, step=0.01)
141
+ sndp = container_col_5.number_input(label='Your sndp:', value=5.50, min_value=0.00, step=0.01)
142
+ sndt = container_col_1.number_input(label='Your sndt:', value=4.20, min_value=0.00, step=0.01)
143
+ xup = container_col_2.number_input(label='Your xup:', value=19.50, min_value=0.00, step=0.01)
144
+ xut = container_col_3.number_input(label='Your xut:', value=20.50, min_value=0.00, step=0.01)
145
+ cl = container_col_4.number_input(label='Your cl:', value=15.10, min_value=0.00, step=0.01)
146
+ ttp = container_col_5.number_input(label='Your ttp:', value=625.80, min_value=0.00, step=0.01)
147
+ ttt = container_col_3.number_input(label='Your ttt:', value=585.40, min_value=0.00, step=0.01)
148
+
149
+ col_1, col_2, col_3, col_4, col_5 = st.columns([1, 1, 1, 1, 1])
150
+
151
+ with col_3:
152
+ predict = st.button(label='Predict', use_container_width=True)
153
+
154
+ if predict:
155
+ if num_of_features == '6 measurements':
156
+ X_6 = [[vtn, vn, vcn, cl, ttp, ttt]]
157
+ X_6 = scaler_6.transform(X_6)
158
+ y_6 = clf_6.predict(X_6)
159
+ st.success(f'We recommend you choosing {y_6} size!')
160
+ elif num_of_features == '8 measurements':
161
+ X_8 = [[ttp, cl, cnnp, vn, vtn, cnnt, cntp, vcn]]
162
+ X_8 = scaler_8.transform(X_8)
163
+ y_8 = clf_8.predict(X_8)
164
+ st.success(f'We recommend you choosing {np.argmax(y_8, axis=1)} size!')
165
+ else:
166
+ X_21 = [[h, w, bmi, vtn, vn, vcn, cn, cnnp, cnnt, cntp, cntt, ccnp, ccnt, snt, sndp, sndt, xup, xut, cl, ttp, ttt]]
167
+ X_21 = scaler_21.transform(X_21)
168
+ y_21 = clf_21.predict(X_21)
169
+ st.success(f'We recommend you choosing {np.argmax(y_21, axis=1)} size!')
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ numpy==1.21.6
2
+ streamlit==1.20.0
3
+ scikit-learn==1.0.2
4
+ tensorflow-gpu==2.10.0
5
+ protobuf==3.19.6