datnguyentien204 commited on
Commit
380e787
·
verified ·
1 Parent(s): 4d7c2af

Upload 25 files

Browse files
.gitattributes CHANGED
@@ -1,35 +1,35 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
.streamlit/config.toml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ [theme]
2
+ base="light"
3
+ primaryColor="#d07777"
4
+ secondaryBackgroundColor="#cbcbcb"
5
+ textColor="#000000"
6
+ font="serif"
Dockerfile ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10.13-slim
2
+
3
+ # Đặt thư mục làm việc
4
+ WORKDIR /app
5
+
6
+ # Cài đặt các thư viện hệ thống cần thiết
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ ffmpeg libsm6 libxext6 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Cài đặt các gói Python trực tiếp
12
+ RUN pip install --no-cache-dir \
13
+ absl-py==2.1.0 \
14
+ aiofiles==23.2.1 \
15
+ altair==4.2.2 \
16
+ annotated-types==0.7.0 \
17
+ anyio==4.6.2.post1 \
18
+ astunparse==1.6.3 \
19
+ attrs==24.2.0 \
20
+ blinker==1.9.0 \
21
+ cachetools==5.5.0 \
22
+ certifi==2024.8.30 \
23
+ charset-normalizer==3.4.0 \
24
+ click==8.1.7 \
25
+ colorama==0.4.6 \
26
+ entrypoints==0.4 \
27
+ exceptiongroup==1.2.2 \
28
+ fastapi==0.115.5 \
29
+ ffmpy==0.4.0 \
30
+ filelock==3.16.1 \
31
+ flatbuffers==24.3.25 \
32
+ fsspec==2024.10.0 \
33
+ gast==0.4.0 \
34
+ gitdb==4.0.11 \
35
+ GitPython==3.1.43 \
36
+ google-auth==2.36.0 \
37
+ google-auth-oauthlib==0.4.6 \
38
+ google-pasta==0.2.0 \
39
+ gradio==5.7.1 \
40
+ gradio_client==1.5.0 \
41
+ grpcio==1.68.0 \
42
+ h11==0.14.0 \
43
+ h5py==3.12.1 \
44
+ httpcore==1.0.7 \
45
+ httpx==0.28.0 \
46
+ huggingface-hub==0.26.3 \
47
+ idna==3.10 \
48
+ importlib_metadata==8.5.0 \
49
+ Jinja2==3.1.4 \
50
+ joblib==1.4.2 \
51
+ jsonschema==4.23.0 \
52
+ jsonschema-specifications==2024.10.1 \
53
+ keras==2.10.0 \
54
+ Keras-Preprocessing==1.1.2 \
55
+ libclang==18.1.1 \
56
+ Markdown==3.7 \
57
+ markdown-it-py==3.0.0 \
58
+ MarkupSafe==2.1.5 \
59
+ mdurl==0.1.2 \
60
+ ml-dtypes==0.4.1 \
61
+ namex==0.0.8 \
62
+ narwhals==1.14.3 \
63
+ numpy==1.26.4 \
64
+ oauthlib==3.2.2 \
65
+ opt_einsum==3.4.0 \
66
+ optree==0.13.1 \
67
+ orjson==3.10.12 \
68
+ packaging==24.2 \
69
+ pandas==2.2.3 \
70
+ pillow==11.0.0 \
71
+ pip==24.2 \
72
+ protobuf==3.19.6 \
73
+ pyarrow==18.1.0 \
74
+ pyasn1==0.6.1 \
75
+ pyasn1_modules==0.4.1 \
76
+ pydantic==2.10.2 \
77
+ pydantic_core==2.27.1 \
78
+ pydeck==0.9.1 \
79
+ pydub==0.25.1
80
+
81
+ # Thêm user không phải root để chạy ứng dụng an toàn hơn
82
+ RUN useradd -m -u 1000 user
83
+ USER user
84
+ ENV HOME /home/user
85
+ ENV PATH $HOME/.local/bin:$PATH
86
+
87
+ # Thiết lập thư mục làm việc cho user
88
+ WORKDIR $HOME/app
89
+ COPY . $HOME/app
90
+
91
+ # Expose port và chạy ứng dụng
92
+ EXPOSE 7860
93
+ CMD streamlit run app.py \
94
+ --server.headless true \
95
+ --server.port 7860 \
96
+ --server.enableCORS false \
97
+ --server.enableXsrfProtection false \
98
+ --server.fileWatcherType none
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/ANN_8.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
README.md CHANGED
@@ -1,10 +1,12 @@
1
- ---
2
- title: VietnameseBreastClassification
3
- emoji: 🐢
4
- colorFrom: purple
5
- colorTo: red
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
1
+ ---
2
+ title: VietnameseBrestClassification
3
+ emoji: 👀
4
+ colorFrom: purple
5
+ colorTo: purple
6
+ sdk: streamlit
7
+ sdk_version: 1.40.2
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ import numpy as np
3
+ import streamlit as st
4
+ from tensorflow.keras.models import load_model
5
+ import warnings
6
+
7
+ warnings.filterwarnings("ignore", category=UserWarning)
8
+
9
+ st.set_page_config(page_title="ViWoBra - Vietnamese WomanBrest Classifier", layout='wide', initial_sidebar_state="collapsed")
10
+
11
+ def load_essential_models(scaler_6_path, scaler_8_path, scaler_full_path, clf_6_path, clf_8_path, clf_full_path):
12
+ scaler_6 = pickle.load(open(file=scaler_6_path, mode='rb'))
13
+ scaler_8 = pickle.load(open(file=scaler_8_path, mode='rb'))
14
+ scaler_21 = pickle.load(open(file=scaler_full_path, mode='rb'))
15
+ clf_6 = pickle.load(open(file=clf_6_path, mode='rb'))
16
+ clf_8 = load_model(clf_8_path, compile=False)
17
+ clf_21 = load_model(clf_full_path, compile=False)
18
+ return scaler_6, scaler_8, scaler_21, clf_6, clf_8, clf_21
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
+
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
+
32
+ header_col_1, header_col_2 = st.columns([3, 2])
33
+ num_of_features = header_col_1.selectbox(label='Please select the number of measurements you have:', options=['6 measurements', '8 measurements', '21 measurements'])
34
+
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)
42
+ vn = container_col_2.number_input(label='Bust circumference (cm):', value=82.40, min_value=0.00, step=0.01)
43
+ vcn = container_col_3.number_input(label='Chest circumference (cm):', value=73.10, min_value=0.00, step=0.01)
44
+ cl = container_col_1.number_input(label='Size difference (cm):', value=9.30, min_value=0.00, step=0.01)
45
+ ttp = container_col_2.number_input(label='Volume of right breast (cm3):', value=325.6, min_value=0.00, step=0.01)
46
+ ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=325.6, min_value=0.00, step=0.01)
47
+ elif sample_options_6 == 'Sample 2 (Medium)':
48
+ vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=77.20, min_value=0.00, step=0.01)
49
+ vn = container_col_2.number_input(label='Bust circumference (cm):', value=78.60, min_value=0.00, step=0.01)
50
+ vcn = container_col_3.number_input(label='Chest circumference (cm):', value=66.50, min_value=0.00, step=0.01)
51
+ cl = container_col_1.number_input(label='Size difference (cm):', value=12.10, min_value=0.00, step=0.01)
52
+ ttp = container_col_2.number_input(label='Volume of right breast (cm3):', value=388.80, min_value=0.00, step=0.01)
53
+ ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=324.60, min_value=0.00, step=0.01)
54
+ else:
55
+ vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=86.50, min_value=0.00, step=0.01)
56
+ vn = container_col_2.number_input(label='Bust circumference (cm):', value=88.00, min_value=0.00, step=0.01)
57
+ vcn = container_col_3.number_input(label='Chest circumference (cm):', value=74.00, min_value=0.00, step=0.01)
58
+ cl = container_col_1.number_input(label='Size difference (cm):', value=14.00, min_value=0.00, step=0.01)
59
+ ttp = container_col_2.number_input(label='Volume of right breast (cm3):', value=451.30, 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)
67
+ cl = container_col_2.number_input(label='Size difference (cm):', value=7.00, min_value=0.00, step=0.01)
68
+ cnnp = container_col_3.number_input(label='Outer right breast curve (cm):', value=8.50, min_value=0.00, step=0.01)
69
+ vn = container_col_4.number_input(label='Bust circumference (cm):', value=74.50, min_value=0.00, step=0.01)
70
+ vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=74.00, min_value=0.00, step=0.01)
71
+ cnnt = container_col_2.number_input(label='Outer left breast curve (cm):', value=8.90, min_value=0.00, step=0.01)
72
+ cntp = container_col_3.number_input(label='Inner right breast curve (cm):', value=8.50, min_value=0.00, step=0.01)
73
+ vcn = container_col_4.number_input(label='Chest circumference (cm):', value=67.50, min_value=0.00, step=0.01)
74
+ elif sample_options_8 == 'Sample 2 (Medium)':
75
+ ttp = container_col_1.number_input(label='Volume of right breast (cm3):', value=489.60, min_value=0.00, step=0.01)
76
+ cl = container_col_2.number_input(label='Size difference (cm):', value=13.00, min_value=0.00, step=0.01)
77
+ cnnp = container_col_3.number_input(label='Outer right breast curve (cm):', value=12.40, min_value=0.00, step=0.01)
78
+ vn = container_col_4.number_input(label='Bust circumference (cm):', value=78.30, min_value=0.00, step=0.01)
79
+ vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=77.20, min_value=0.00, step=0.01)
80
+ cnnt = container_col_2.number_input(label='Outer left breast curve (cm):', value=11.60, min_value=0.00, step=0.01)
81
+ cntp = container_col_3.number_input(label='Inner right breast curve (cm):', value=8.70, min_value=0.00, step=0.01)
82
+ vcn = container_col_4.number_input(label='Chest circumference (cm):', value=65.30, min_value=0.00, step=0.01)
83
+ else:
84
+ ttp = container_col_1.number_input(label='Volume of right breast (cm3):', value=568.2, min_value=0.00, step=0.01)
85
+ cl = container_col_2.number_input(label='Size difference (cm):', value=13.7, min_value=0.00, step=0.01)
86
+ cnnp = container_col_3.number_input(label='Outer right breast curve (cm):', value=14.0, min_value=0.00, step=0.01)
87
+ vn = container_col_4.number_input(label='Bust circumference (cm):', value=88.7, min_value=0.00, step=0.01)
88
+ vtn = container_col_1.number_input(label='Upper bust circumference (cm):', value=86.5, min_value=0.00, step=0.01)
89
+ cnnt = container_col_2.number_input(label='Outer left breast curve (cm):', value=12.5, 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)
97
+ w = container_col_2.number_input(label='Weight (kg):', value=44.00, min_value=0.00, step=0.01)
98
+ bmi = container_col_3.number_input(label='BMI (kg/h^2):', value=17.50, min_value=0.00, step=0.01)
99
+ vtn = container_col_4.number_input(label='Upper bust circumference (cm): ', value=75.40, min_value=0.00, step=0.01)
100
+ vn = container_col_5.number_input(label='Bust circumference (cm):', value=81.10, min_value=0.00, step=0.01)
101
+ vcn = container_col_1.number_input(label='Chest circumference (cm):', value=74.80, min_value=0.00, step=0.01)
102
+ cn = container_col_2.number_input(label='Distance between nipple points (cm):', value=14.50, min_value=0.00, step=0.01)
103
+ cnnp = container_col_3.number_input(label='Outer right breast curve (cm):', value=13.80, min_value=0.00, step=0.01)
104
+ cnnt = container_col_4.number_input(label='Outer left breast curve (cm):', value=14.40, min_value=0.00, step=0.01)
105
+ cntp = container_col_5.number_input(label='Inner right breast curve (cm):', value=8.60, min_value=0.00, step=0.01)
106
+ cntt = container_col_1.number_input(label='Inner left breast curve (cm):', value=8.40, min_value=0.00, step=0.01)
107
+ ccnp = container_col_2.number_input(label='Right breast curve (cm):', value=21.50, min_value=0.00, step=0.01)
108
+ ccnt = container_col_3.number_input(label='Left breast curve (cm):', value=21.20, min_value=0.00, step=0.01)
109
+ snt = container_col_4.number_input(label='Upper breast projection (cm):', value=8.90, min_value=0.00, step=0.01)
110
+ sndp = container_col_5.number_input(label='Lower right breast projection (cm):', value=6.50, min_value=0.00, step=0.01)
111
+ sndt = container_col_1.number_input(label='Lower left breast projection (cm):', value=6.50, min_value=0.00, step=0.01)
112
+ xup = container_col_2.number_input(label='Distance from sternum to right nipple point (cm):', value=21.80, min_value=0.00, step=0.01)
113
+ xut = container_col_3.number_input(label='Distance from sternum to left nipple point (cm):', value=21.10, min_value=0.00, step=0.01)
114
+ cl = container_col_4.number_input(label='Size difference (cm):', value=6.30, min_value=0.00, step=0.01)
115
+ ttp = container_col_5.number_input(label='Volume of right breast (cm3):', value=325.10, min_value=0.00, step=0.01)
116
+ ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=335.70, min_value=0.00, step=0.01)
117
+ elif sample_options_21 == 'Sample 2 (Medium)':
118
+ h = container_col_1.number_input(label='Height (cm):', value=163.00, min_value=0.00, step=0.01)
119
+ w = container_col_2.number_input(label='Weight (kg):', value=43.00, min_value=0.00, step=0.01)
120
+ bmi = container_col_3.number_input(label='BMI (kg/h^2):', value=16.20, min_value=0.00, step=0.01)
121
+ vtn = container_col_4.number_input(label='Upper bust circumference (cm): ', value=76.00, min_value=0.00, step=0.01)
122
+ vn = container_col_5.number_input(label='Bust circumference (cm):', value=79.00, min_value=0.00, step=0.01)
123
+ vcn = container_col_1.number_input(label='Chest circumference (cm):', value=64.00, min_value=0.00, step=0.01)
124
+ cn = container_col_2.number_input(label='Distance between nipple points (cm):', value=16.50, min_value=0.00, step=0.01)
125
+ cnnp = container_col_3.number_input(label='Outer right breast curve (cm):', value=13.10, min_value=0.00, step=0.01)
126
+ cnnt = container_col_4.number_input(label='Outer left breast curve (cm):', value=12.60, min_value=0.00, step=0.01)
127
+ cntp = container_col_5.number_input(label='Inner right breast curve (cm):', value=9.20, min_value=0.00, step=0.01)
128
+ cntt = container_col_1.number_input(label='Inner left breast curve (cm):', value=9.10, min_value=0.00, step=0.01)
129
+ ccnp = container_col_2.number_input(label='Right breast curve (cm):', value=19.80, min_value=0.00, step=0.01)
130
+ ccnt = container_col_3.number_input(label='Left breast curve (cm):', value=18.20, min_value=0.00, step=0.01)
131
+ snt = container_col_4.number_input(label='Upper breast projection (cm):', value=8.40, min_value=0.00, step=0.01)
132
+ sndp = container_col_5.number_input(label='Lower right breast projection (cm):', value=3.50, min_value=0.00, step=0.01)
133
+ sndt = container_col_1.number_input(label='Lower left breast projection (cm):', value=3.70, min_value=0.00, step=0.01)
134
+ xup = container_col_2.number_input(label='Distance from sternum to right nipple point (cm):', value=21.00, min_value=0.00, step=0.01)
135
+ xut = container_col_3.number_input(label='Distance from sternum to left nipple point (cm):', value=20.50, min_value=0.00, step=0.01)
136
+ cl = container_col_4.number_input(label='Size difference (cm):', value=15.00, min_value=0.00, step=0.01)
137
+ ttp = container_col_5.number_input(label='Volume of right breast (cm3):', value=521.60, min_value=0.00, step=0.01)
138
+ ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=513.50, min_value=0.00, step=0.01)
139
+ else:
140
+ h = container_col_1.number_input(label='Height (cm):', value=152.00, min_value=0.00, step=0.01)
141
+ w = container_col_2.number_input(label='Weight (kg):', value=46.00, min_value=0.00, step=0.01)
142
+ bmi = container_col_3.number_input(label='BMI (kg/h^2):', value=19.90, min_value=0.00, step=0.01)
143
+ vtn = container_col_4.number_input(label='Upper bust circumference (cm): ', value=77.50, min_value=0.00, step=0.01)
144
+ vn = container_col_5.number_input(label='Bust circumference (cm):', value=85.50, min_value=0.00, step=0.01)
145
+ vcn = container_col_1.number_input(label='Chest circumference (cm):', value=70.40, min_value=0.00, step=0.01)
146
+ cn = container_col_2.number_input(label='Distance between nipple points (cm):', value=18.90, min_value=0.00, step=0.01)
147
+ cnnp = container_col_3.number_input(label='Outer right breast curve (cm):', value=13.50, min_value=0.00, step=0.01)
148
+ cnnt = container_col_4.number_input(label='Outer left breast curve (cm):', value=12.50, min_value=0.00, step=0.01)
149
+ cntp = container_col_5.number_input(label='Inner right breast curve (cm):', value=10.30, min_value=0.00, step=0.01)
150
+ cntt = container_col_1.number_input(label='Inner left breast curve (cm):', value=10.50, min_value=0.00, step=0.01)
151
+ ccnp = container_col_2.number_input(label='Right breast curve (cm):', value=20.40, min_value=0.00, step=0.01)
152
+ ccnt = container_col_3.number_input(label='Left breast curve (cm):', value=20.10, min_value=0.00, step=0.01)
153
+ snt = container_col_4.number_input(label='Upper breast projection (cm):', value=8.50, min_value=0.00, step=0.01)
154
+ sndp = container_col_5.number_input(label='Lower right breast projection (cm):', value=5.50, min_value=0.00, step=0.01)
155
+ sndt = container_col_1.number_input(label='Lower left breast projection (cm):', value=4.20, min_value=0.00, step=0.01)
156
+ xup = container_col_2.number_input(label='Distance from sternum to right nipple point (cm):', value=19.50, min_value=0.00, step=0.01)
157
+ xut = container_col_3.number_input(label='Distance from sternum to left nipple point (cm):', value=20.50, min_value=0.00, step=0.01)
158
+ cl = container_col_4.number_input(label='Size difference (cm):', value=15.10, min_value=0.00, step=0.01)
159
+ ttp = container_col_5.number_input(label='Volume of right breast (cm3):', value=625.80, min_value=0.00, step=0.01)
160
+ ttt = container_col_3.number_input(label='Volume of left breast (cm3):', value=585.40, min_value=0.00, step=0.01)
161
+
162
+ col_1, col_2, col_3, col_4, col_5 = st.columns([1, 1, 1, 1, 1])
163
+
164
+ with col_3:
165
+ predict = st.button(label='Predict', use_container_width=True)
166
+
167
+ if predict:
168
+ if num_of_features == '6 measurements':
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(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':
179
+ X_8 = np.array([[ttp, cl, cnnp, vn, vtn, cnnt, cntp, vcn]])
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)
images/1.png ADDED
images/10.png ADDED
images/11.png ADDED
images/2.png ADDED
images/3.png ADDED
images/4.png ADDED
images/5.png ADDED
images/6.png ADDED
images/7.png ADDED
images/8.png ADDED
images/9.png ADDED
measurement_details.csv ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ No;Measurements;Image illustration;Determining measurements methods
2
+ 1;Height;;The subject's standing height was measured with a straightedge in the standing position according to ISO 20685 standard, measuring the distance from the standing floor to the highest point at the top of the head, in the midsagittal plane when the head was held in the Frankfurt plane. (is the plane passing through the upper edge of the external auditory canal and the lower edge of the orbital rim, perpendicular to the vertical plane containing the axis of the body).
3
+ 2;Weight;;The weight of the measured object is determined by an electronic scale with a measuring range of 0÷100 kg, error ± 0.01 kg.
4
+ 3;BMI;;BMI is calculated from height and weight measurement results according to the formula: bmi = w/h² In which, w is weight (kg), h is the height (m).
5
+ 4;Upper bust circumference;Figure 1;On the subject's 3D body scan data, the size of the upper chest circumference (L1) is determined by creating a plane parallel to the body axis cutting through the torso at the armpit level. The circumference that surrounds the outside of the torso and lies on the cutting plane is the thoracic circumference of the body.
6
+ 5;Bust circumference;Figure 2;Chest size (L2) is determined by creating a plane parallel to the body axis cutting through the torso at the fullest position of the chest. The contour circumference surrounding the outer points of the torso and lying on the cutting plane is the body's chest girth.
7
+ 6;Chest circumference;Figure 3;The size of the chest circumference (L3) is determined by the cross-sectional circumference by a plane perpendicular to the body axis through the lowest point of the chest.
8
+ 7;Upper breast projection;;Upper chest prolapse (D1) is calculated as the distance from the nipple point (P4) to the plane cutting through the upper chest point (P1).
9
+ 8;Lower right breast projection;Figure 4;Right lower chest prolapse (D2) is the distance from the right nipple point (P4) to the plane cutting through the lowest point of the chest.
10
+ 9;Lower left breast projection;Figure 4;Left lower chest ptosis (D2') is the distance from the tip of the left chest (P4') to the plane cutting through the lowest point of the chest.
11
+ 10;Distance between nipple points;Figure 5;The distance between the two nipples is determined by measuring the distance from the right nipple point (P4) to the left nipple point (P4'). In case the two nipple points are not on the same horizontal plane, the distance from the chest is calculated as the total distance from the nipple point (P4), (P4') to the vertical line between the front body.
12
+ 11;Right breast curve;Figure 6;The right pectoral arch (P_5 P_6 P_7 ) ̂ is determined according to the curve from the innermost point of the right breast (P6) through point P7 to the outermost point of the left breast (P5).
13
+ 12;Left breast curve;Figure 6;The left pectoral arch is determined similarly to the right pectoral arch but on the left side of the chest.
14
+ 13;Outer right breast curve;Figure 7;The right external chest arc (P_4 P_5 ) ̂ is calculated from the midpoint of the breast (P5) to the right nipple point (P4), measured along the chest arc line.
15
+ 14;Outer left breast curve;Figure 7;The left external chest arc (P_4' P_5' ) ̂ is calculated from the midpoint of the breast (P5') to the left nipple point (P4'), measured along the chest arc line.
16
+ 15;Inner right breast curve;Figure 8;The internal chest arc must be calculated from point (P6) to the right nipple point (P4) along the chest arc line.
17
+ 16;Inner left breast curve;Figure 8;The left internal chest arc is calculated from the point (P6') to the left chest tip point (P4') along the chest arc line.
18
+ 17;Distance from Sternum to right nipple point;Figure 9;The distance from the sternum to the right nipple is measured from the middle of the front neck (P1) to the right nipple (P4).
19
+ 18;Distance from Sternum to left nipple point;Figure 9;The distance from the sternum to the left nipple is measured from the middle of the anterior neck (P1) to the left nipple (P4').
20
+ 19;Size difference;;Equal to the difference between bust circumference and bust circumference.
21
+ 20;Volume of left breast;Figure 10;The volume of the left breast of the body (ttt) was performed by marking the breast based on landmarks around the chest. Then the breast was separated from the body, filled and the volume of the left breast was calculated.
22
+ 21;Volume of right breast;Figure 11;Right body breast volume (ttp) was performed by marking the breast based on landmarks around the chest. The breast was then separated from the body, filled, and the volume of the right breast was calculated.
pages/User manual.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ st.set_page_config(layout='wide')
5
+ st.markdown("<h1 style='text-align: center;'>User manual</h1>", unsafe_allow_html=True)
6
+
7
+ st.write()
8
+
9
+ st.markdown("<h6 style='text-align: justify;'>We built a demo system for the problem of classifying Vietnamese women's bras. To use our demo system, you need to determine how many measurements you can feed to our prediction model. We provide 3 options for you to provide measurements for the decision-making model, including: 6 measurements, 8 measurements and 21 measurements.</h6>", unsafe_allow_html=True)
10
+ col_11, col_21, col_31 = st.columns([1, 1, 1])
11
+
12
+ with col_11:
13
+ st.markdown("<h6 style='text-align: justify;'>1. Upper bust circumference</h6>", unsafe_allow_html=True)
14
+ st.markdown("<h6 style='text-align: justify;'>4. Size difference</h6>", unsafe_allow_html=True)
15
+ with col_21:
16
+ st.markdown("<h6 style='text-align: justify;'>2. Bust circumference</h6>", unsafe_allow_html=True)
17
+ st.markdown("<h6 style='text-align: justify;'>5. Volume of right breast</h6>", unsafe_allow_html=True)
18
+ with col_31:
19
+ st.markdown("<h6 style='text-align: justify;'>3. Chest circumference</h6>", unsafe_allow_html=True)
20
+ st.markdown("<h6 style='text-align: justify;'>6. Volume of left breast</h6>", unsafe_allow_html=True)
21
+
22
+ st.markdown("<h6 style='text-align: justify;'>With 8 input measurements, you need to provide us with the following measurements:</h6>", unsafe_allow_html=True)
23
+ col_12, col_22, col_32 = st.columns([1, 1, 1])
24
+
25
+ with col_12:
26
+ st.markdown("<h6 style='text-align: justify;'>1. Volume of right breast</h6>", unsafe_allow_html=True)
27
+ st.markdown("<h6 style='text-align: justify;'>4. Bust circumference</h6>", unsafe_allow_html=True)
28
+ st.markdown("<h6 style='text-align: justify;'>7. Inner right breast curve</h6>", unsafe_allow_html=True)
29
+ with col_22:
30
+ st.markdown("<h6 style='text-align: justify;'>2. Size difference</h6>", unsafe_allow_html=True)
31
+ st.markdown("<h6 style='text-align: justify;'>5. Upper bust circumference</h6>", unsafe_allow_html=True)
32
+ st.markdown("<h6 style='text-align: justify;'>8. Chest circumference</h6>", unsafe_allow_html=True)
33
+ with col_32:
34
+ st.markdown("<h6 style='text-align: justify;'>3. Outer right breast curve</h6>", unsafe_allow_html=True)
35
+ st.markdown("<h6 style='text-align: justify;'>6. Outer left breast curve</h6>", unsafe_allow_html=True)
36
+
37
+ st.markdown("<h6 style='text-align: justify;'>With 21 input measurements, you need to provide us with the following measurements:</h6>", unsafe_allow_html=True)
38
+ col_13, col_23, col_33 = st.columns([1, 1, 1])
39
+
40
+ with col_13:
41
+ st.markdown("<h6 style='text-align: left;'>1. Height</h6>", unsafe_allow_html=True)
42
+ st.markdown("<h6 style='text-align: left;'>4. Upper bust circumference</h6>", unsafe_allow_html=True)
43
+ st.markdown("<h6 style='text-align: left;'>7. Distance between nipple points</h6>", unsafe_allow_html=True)
44
+ st.markdown("<h6 style='text-align: left;'>10. Inner right breast curve</h6>", unsafe_allow_html=True)
45
+ st.markdown("<h6 style='text-align: left;'>13. Left breast curve </h6>", unsafe_allow_html=True)
46
+ st.markdown("<h6 style='text-align: left;'>16. Lower left breast projection</h6>", unsafe_allow_html=True)
47
+ st.markdown("<h6 style='text-align: left;'>19. Size difference</h6>", unsafe_allow_html=True)
48
+ with col_23:
49
+ st.markdown("<h6 style='text-align: left;'>2. Weight</h6>", unsafe_allow_html=True)
50
+ st.markdown("<h6 style='text-align: left;'>5. Bust circumference </h6>", unsafe_allow_html=True)
51
+ st.markdown("<h6 style='text-align: left;'>8. Outer right breast curve </h6>", unsafe_allow_html=True)
52
+ st.markdown("<h6 style='text-align: left;'>11. Inner left breast curve</h6>", unsafe_allow_html=True)
53
+ st.markdown("<h6 style='text-align: left;'>14. Upper breast projection</h6>", unsafe_allow_html=True)
54
+ st.markdown("<h6 style='text-align: left;'>17. Distance from sternum to right nipple point</h6>", unsafe_allow_html=True)
55
+ st.markdown("<h6 style='text-align: left;'>20. Volume of right breast</h6>", unsafe_allow_html=True)
56
+ with col_33:
57
+ st.markdown("<h6 style='text-align: left;'>3. BMI</h6>", unsafe_allow_html=True)
58
+ st.markdown("<h6 style='text-align: left;'>6. Chest circumference </h6>", unsafe_allow_html=True)
59
+ st.markdown("<h6 style='text-align: left;'>9. Outer left breast curve </h6>", unsafe_allow_html=True)
60
+ st.markdown("<h6 style='text-align: left;'>12. Right breast curve </h6>", unsafe_allow_html=True)
61
+ st.markdown("<h6 style='text-align: left;'>15. Lower right breast projection</h6>", unsafe_allow_html=True)
62
+ st.markdown("<h6 style='text-align: left;'>18. Distance from sternum to left nipple point </h6>", unsafe_allow_html=True)
63
+ st.markdown("<h6 style='text-align: left;'>21. Volume of left breast</h6>", unsafe_allow_html=True)
64
+
65
+ st.markdown("<h6 style='text-align: justify;'> After you finish entering the input measurements, click on the 'Predict' button, our model will return the results corresponding to the input data. Additionally, you can use our available measurements samples in the 'Measurement sample options' section.</h6>", unsafe_allow_html=True)
66
+ st.markdown("<h6 style='text-align: justify;'> Detailed information about the parameters included in the demo system is explained in more detail in the section below.</h6>", unsafe_allow_html=True)
67
+
68
+ st.markdown("<h1 style='text-align: center;'>Detail of measurements</h1>", unsafe_allow_html=True)
69
+
70
+ df = pd.read_csv('measurement_details.csv', sep=';', index_col=False)
71
+ st.dataframe(data=df, use_container_width=True, height=773)
72
+
73
+ st.markdown("<h3 style='text-align: center;'>Figure references</h3>", unsafe_allow_html=True)
74
+
75
+ col_1, col_2, col_3, col_4, col_5 = st.columns([1, 1, 1, 1, 1])
76
+ with col_1:
77
+ st.image(image='./images/1.png', caption='Figure 1', use_column_width=True)
78
+ st.image(image='./images/6.png', caption='Figure 6', use_column_width=True)
79
+
80
+ with col_2:
81
+ st.image(image='./images/2.png', caption='Figure 2', use_column_width=True)
82
+ st.image(image='./images/7.png', caption='Figure 7', use_column_width=True)
83
+
84
+ with col_3:
85
+ st.image(image='./images/3.png', caption='Figure 3', use_column_width=True)
86
+ st.image(image='./images/8.png', caption='Figure 8', use_column_width=True)
87
+ st.image(image='./images/11.png', caption='Figure 11', use_column_width=True)
88
+ with col_4:
89
+ st.image(image='./images/4.png', caption='Figure 4', use_column_width=True)
90
+ st.image(image='./images/9.png', caption='Figure 9', use_column_width=True)
91
+
92
+ with col_5:
93
+ st.image(image='./images/5.png', caption='Figure 5', use_column_width=True)
94
+ st.image(image='./images/10.png', caption='Figure 10', use_column_width=True)
95
+
pages/styles.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ . main{
2
+ text-align: justify;
3
+ }