popxe1 commited on
Commit
b0be063
·
verified ·
1 Parent(s): 19316af

Upload 9 files

Browse files
Files changed (9) hide show
  1. .gitignore +15 -0
  2. CSD_MT_eval.py +238 -0
  3. README.md +16 -0
  4. build.gradle.kts +5 -0
  5. gradio_makeup_transfer.py +88 -0
  6. gradle.properties +21 -0
  7. gradlew +185 -0
  8. gradlew.bat +89 -0
  9. settings.gradle.kts +17 -0
.gitignore ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.iml
2
+ .gradle
3
+ /local.properties
4
+ /.idea/caches
5
+ /.idea/libraries
6
+ /.idea/modules.xml
7
+ /.idea/workspace.xml
8
+ /.idea/navEditor.xml
9
+ /.idea/assetWizardSettings.xml
10
+ .DS_Store
11
+ /build
12
+ /captures
13
+ .externalNativeBuild
14
+ .cxx
15
+ local.properties
CSD_MT_eval.py ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ import cv2
4
+ import os.path as osp
5
+ import numpy as np
6
+ from PIL import Image
7
+ from CSD_MT.options import Options
8
+ from CSD_MT.model import CSD_MT
9
+ from faceutils.face_parsing.model import BiSeNet
10
+ import torchvision.transforms as transforms
11
+ import faceutils as futils
12
+
13
+ import warnings
14
+ warnings.filterwarnings("ignore", category=FutureWarning, module="torch")
15
+
16
+ # load face_parsing model
17
+ n_classes = 19
18
+ face_paseing_model = BiSeNet(n_classes=n_classes)
19
+ save_pth = osp.join('faceutils/face_parsing/res/cp', '79999_iter.pth')
20
+ face_paseing_model.load_state_dict(torch.load(save_pth,map_location='cpu'))
21
+ face_paseing_model.eval()
22
+
23
+ # load makeup transfer model
24
+ parser = Options()
25
+ opts = parser.parse()
26
+ makeup_model = CSD_MT(opts)
27
+ ep0, total_it = makeup_model.resume('CSD_MT/weights/CSD_MT.pth')
28
+ makeup_model.eval()
29
+
30
+ def crop_image(image):
31
+ up_ratio = 0.2 / 0.85 # delta_size / face_size
32
+ down_ratio = 0.15 / 0.85 # delta_size / face_size
33
+ width_ratio = 0.2 / 0.85 # delta_size / face_size
34
+
35
+ image = Image.fromarray(image)
36
+ face = futils.dlib.detect(image)
37
+
38
+ if not face:
39
+ raise ValueError("No face !")
40
+
41
+ face_on_image = face[0]
42
+
43
+ image, face, crop_face = futils.dlib.crop(image, face_on_image, up_ratio, down_ratio, width_ratio)
44
+ np_image = np.array(image)
45
+ return np_image
46
+
47
+ def get_face_parsing(x):
48
+ to_tensor = transforms.Compose([
49
+ transforms.ToTensor(),
50
+ transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
51
+ ])
52
+ with torch.no_grad():
53
+ img = Image.fromarray(x)
54
+ image = img.resize((512, 512), Image.BILINEAR)
55
+ img = to_tensor(image)
56
+ img = torch.unsqueeze(img, 0)
57
+ out = face_paseing_model(img)[0]
58
+ parsing = out.squeeze(0).cpu().numpy().argmax(0)
59
+ return parsing
60
+
61
+
62
+ def split_parse(opts,parse):
63
+ h, w = parse.shape
64
+ result = np.zeros([h, w, opts.semantic_dim])
65
+ result[:, :, 0][np.where(parse == 0)] = 1
66
+ result[:, :, 0][np.where(parse == 16)] = 1
67
+ result[:, :, 0][np.where(parse == 17)] = 1
68
+ result[:, :, 0][np.where(parse == 18)] = 1
69
+ result[:, :, 0][np.where(parse == 9)] = 1
70
+ result[:, :, 1][np.where(parse == 1)] = 1
71
+ result[:, :, 2][np.where(parse == 2)] = 1
72
+ result[:, :, 2][np.where(parse == 3)] = 1
73
+ result[:, :, 3][np.where(parse == 4)] = 1
74
+ result[:, :, 3][np.where(parse == 5)] = 1
75
+ result[:, :, 1][np.where(parse == 6)] = 1
76
+ result[:, :, 4][np.where(parse == 7)] = 1
77
+ result[:, :, 4][np.where(parse == 8)] = 1
78
+ result[:, :, 5][np.where(parse == 10)] = 1
79
+ result[:, :, 6][np.where(parse == 11)] = 1
80
+ result[:, :, 7][np.where(parse == 12)] = 1
81
+ result[:, :, 8][np.where(parse == 13)] = 1
82
+ result[:, :, 9][np.where(parse == 14)] = 1
83
+ result[:, :, 9][np.where(parse == 15)] = 1
84
+ result = np.array(result)
85
+ return result
86
+
87
+
88
+ def local_masks(opts,split_parse):
89
+ h, w, c = split_parse.shape
90
+ all_mask = np.zeros([h, w])
91
+ all_mask[np.where(split_parse[:, :, 0] == 0)] = 1
92
+ all_mask[np.where(split_parse[:, :, 3] == 1)] = 0
93
+ all_mask[np.where(split_parse[:, :, 6] == 1)] = 0
94
+ all_mask = np.expand_dims(all_mask, axis=2) # Expansion of the dimension
95
+ all_mask = np.concatenate((all_mask, all_mask, all_mask), axis=2)
96
+ return all_mask
97
+
98
+
99
+
100
+ def load_data_from_image(non_makeup_img, makeup_img,opts):
101
+ non_makeup_img=crop_image(non_makeup_img)
102
+ makeup_img = crop_image(makeup_img)
103
+ non_makeup_img=cv2.resize(non_makeup_img,(opts.resize_size,opts.resize_size))
104
+ makeup_img = cv2.resize(makeup_img, (opts.resize_size, opts.resize_size))
105
+ non_makeup_parse = get_face_parsing(non_makeup_img)
106
+ non_makeup_parse = cv2.resize(non_makeup_parse, (opts.resize_size, opts.resize_size),interpolation=cv2.INTER_NEAREST)
107
+ makeup_parse = get_face_parsing(makeup_img)
108
+ makeup_parse = cv2.resize(makeup_parse, (opts.resize_size, opts.resize_size),interpolation=cv2.INTER_NEAREST)
109
+
110
+ non_makeup_split_parse = split_parse(opts,non_makeup_parse)
111
+ makeup_split_parse = split_parse(opts,makeup_parse)
112
+
113
+ non_makeup_all_mask = local_masks(opts,
114
+ non_makeup_split_parse)
115
+ makeup_all_mask = local_masks(opts,
116
+ makeup_split_parse)
117
+
118
+ non_makeup_img = non_makeup_img / 127.5 - 1
119
+ non_makeup_img = np.transpose(non_makeup_img, (2, 0, 1))
120
+ non_makeup_split_parse = np.transpose(non_makeup_split_parse, (2, 0, 1))
121
+
122
+ makeup_img = makeup_img / 127.5 - 1
123
+ makeup_img = np.transpose(makeup_img, (2, 0, 1))
124
+ makeup_split_parse = np.transpose(makeup_split_parse, (2, 0, 1))
125
+
126
+ non_makeup_img=torch.from_numpy(non_makeup_img).type(torch.FloatTensor)
127
+ non_makeup_img = torch.unsqueeze(non_makeup_img, 0)
128
+ non_makeup_split_parse = torch.from_numpy(non_makeup_split_parse).type(torch.FloatTensor)
129
+ non_makeup_split_parse = torch.unsqueeze(non_makeup_split_parse, 0)
130
+ non_makeup_all_mask = np.transpose(non_makeup_all_mask, (2, 0, 1))
131
+
132
+ makeup_img = torch.from_numpy(makeup_img).type(torch.FloatTensor)
133
+ makeup_img = torch.unsqueeze(makeup_img, 0)
134
+ makeup_split_parse = torch.from_numpy(makeup_split_parse).type(torch.FloatTensor)
135
+ makeup_split_parse = torch.unsqueeze(makeup_split_parse, 0)
136
+ makeup_all_mask = np.transpose(makeup_all_mask, (2, 0, 1))
137
+
138
+ data = {'non_makeup_color_img': non_makeup_img,
139
+ 'non_makeup_split_parse':non_makeup_split_parse,
140
+ 'non_makeup_all_mask': torch.unsqueeze(torch.from_numpy(non_makeup_all_mask).type(torch.FloatTensor), 0),
141
+
142
+ 'makeup_color_img': makeup_img,
143
+ 'makeup_split_parse': makeup_split_parse,
144
+ 'makeup_all_mask': torch.unsqueeze(torch.from_numpy(makeup_all_mask).type(torch.FloatTensor), 0)
145
+ }
146
+ return data
147
+
148
+
149
+ def extract_eye_mask(parsing, expansion=20, upward_bias=20, side_bias=20):
150
+ # 눈 영역 마스크 생성
151
+
152
+ eye_mask = np.zeros_like(parsing, dtype=np.uint8)
153
+ eye_mask[np.where(parsing == 4)] = 1 # 왼쪽 눈
154
+ eye_mask[np.where(parsing == 5)] = 1 # 오른쪽 눈
155
+
156
+ # 기본 확장
157
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (expansion, expansion))
158
+ expanded_mask = cv2.dilate(eye_mask, kernel, iterations=1)
159
+
160
+ upward_mask = np.zeros_like(expanded_mask)
161
+ upward_mask[:-upward_bias, :] = expanded_mask[upward_bias:, :]
162
+
163
+ left_mask = np.zeros_like(expanded_mask)
164
+ left_mask[:, :-side_bias] = expanded_mask[:, side_bias:]
165
+
166
+ right_mask = np.zeros_like(expanded_mask)
167
+ right_mask[:, side_bias:] = expanded_mask[:, :-side_bias]
168
+
169
+ final_mask = np.clip(expanded_mask + upward_mask + left_mask + right_mask, 0, 1)
170
+
171
+ return final_mask
172
+
173
+ def extract_eyebrow_mask(parsing):
174
+ # 눈썹 마스크 생성
175
+
176
+ eyebrow_mask = np.zeros_like(parsing, dtype=np.uint8)
177
+ eyebrow_mask[np.where(parsing == 2)] = 1 # 왼쪽 눈썹
178
+ eyebrow_mask[np.where(parsing == 3)] = 1 # 오른쪽 눈썹
179
+ return eyebrow_mask
180
+
181
+ def extract_lips_mask(parsing):
182
+ # 입술 마스크 생성
183
+
184
+ lips_mask = np.zeros_like(parsing, dtype=np.uint8)
185
+ lips_mask[np.where(parsing == 12)] = 1 # 윗입술
186
+ lips_mask[np.where(parsing == 13)] = 1 # 아랫입술
187
+ return lips_mask
188
+
189
+
190
+ def makeup_transfer256(non_makeup_image, makeup_image, alpha_values, regions):
191
+ """
192
+ 메이크업 전이 함수: 영역별로 다른 alpha 값을 사용하여 특정 영역에 필터 적용.
193
+ """
194
+ # 메이크업 전이 수행
195
+ data = load_data_from_image(non_makeup_image, makeup_image, opts=opts)
196
+ with torch.no_grad():
197
+ transfer_tensor = makeup_model.test_pair(data)
198
+ transfer_img = transfer_tensor[0].cpu().float().numpy()
199
+ transfer_img = np.transpose((transfer_img / 2 + 0.5) * 255., (1, 2, 0))
200
+ transfer_img = np.clip(transfer_img, 0, 255).astype(np.uint8)
201
+
202
+ # 원본 이미지 크기에 맞게 리사이즈
203
+ target_size = (non_makeup_image.shape[1], non_makeup_image.shape[0])
204
+ transfer_img = cv2.resize(transfer_img, target_size, interpolation=cv2.INTER_LINEAR)
205
+
206
+ # 얼굴 파싱 및 영역별 마스크 생성
207
+ non_makeup_parse = get_face_parsing(non_makeup_image)
208
+ masks = {
209
+ "eye": extract_eye_mask(non_makeup_parse),
210
+ "eyebrow": extract_eyebrow_mask(non_makeup_parse),
211
+ "lip": extract_lips_mask(non_makeup_parse),
212
+ }
213
+
214
+ # 결과 이미지 생성
215
+ result_image = non_makeup_image.astype(np.float32)
216
+ transfer_img = transfer_img.astype(np.float32)
217
+
218
+ # 선택된 영역에만 메이크업 적용
219
+ for region in regions:
220
+ mask = masks.get(region, None)
221
+ if mask is not None:
222
+ mask = cv2.resize(mask, target_size, interpolation=cv2.INTER_NEAREST)
223
+ mask = cv2.GaussianBlur(mask.astype(np.float32), (9, 9), 0)
224
+ mask = mask / mask.max()
225
+
226
+ alpha = alpha_values.get(region, 1) # 해당 영역의 alpha 값 가져오기
227
+ for c in range(3): # RGB 채널별 적용
228
+ result_image[:, :, c] = result_image[:, :, c] * (1 - alpha * mask) + transfer_img[:, :, c] * (
229
+ alpha * mask
230
+ )
231
+
232
+ # 전체 영역에 대한 처리 (regions="all")
233
+ if "all" in regions:
234
+ alpha = alpha_values.get("all", 1)
235
+ for c in range(3):
236
+ result_image[:, :, c] = result_image[:, :, c] * (1 - alpha) + transfer_img[:, :, c] * alpha
237
+
238
+ return result_image.astype(np.uint8)
README.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### MakeupSimulator
2
+
3
+ Hi there,
4
+ This is a project for 'make-up simulator'😎😎
5
+ You could make up your face images in simulator!!
6
+
7
+
8
+ # Our Features
9
+
10
+ 1. Make up transfer
11
+ 2. Two types of Color control
12
+ 1) filter-based
13
+ 2) user-based
14
+ 3. Enhance image equaity
15
+ 4. Recommend make-up products in real
16
+
build.gradle.kts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ plugins {
2
+ id("com.android.application") version "8.1.1" apply false
3
+ id("org.jetbrains.kotlin.android") version "1.9.0" apply false
4
+ }
5
+
gradio_makeup_transfer.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ import cv2
4
+ import time
5
+ import os.path as osp
6
+ import numpy as np
7
+ from PIL import Image
8
+ import torchvision.transforms as transforms
9
+ import gradio as gr
10
+ import CSD_MT_eval
11
+
12
+ def get_makeup_transfer_results256(non_makeup_img, makeup_img, alpha_eye, alpha_eyebrow, alpha_lip, alpha_all, regions):
13
+
14
+ # Alpha 값을 영역별로 매핑
15
+ alpha_values = {
16
+ "eye": alpha_eye,
17
+ "eyebrow": alpha_eyebrow,
18
+ "lip": alpha_lip,
19
+ "all": alpha_all,
20
+ }
21
+
22
+ # 메이크업 전이 수행
23
+ transfer_img = CSD_MT_eval.makeup_transfer256(non_makeup_img, makeup_img, alpha_values, regions)
24
+ return transfer_img
25
+
26
+
27
+
28
+ example = {}
29
+ non_makeup_dir = 'examples/non_makeup'
30
+ makeup_dir = 'examples/makeup'
31
+ non_makeup_list = [os.path.join(non_makeup_dir, file) for file in os.listdir(non_makeup_dir)]
32
+ non_makeup_list.sort()
33
+ makeup_list = [os.path.join(makeup_dir, file) for file in os.listdir(makeup_dir)]
34
+ makeup_list.sort()
35
+
36
+ # Gradio 인터페이스 정의
37
+ with gr.Blocks() as demo:
38
+ with gr.Group():
39
+ with gr.Tab("CSD-MT"):
40
+ with gr.Row():
41
+ with gr.Column():
42
+ # Non-makeup 및 Makeup 이미지 업로드
43
+ non_makeup = gr.Image(source='upload', elem_id="image_upload", type="numpy",
44
+ label="Non-makeup Image")
45
+ gr.Examples(non_makeup_list, inputs=[non_makeup], label="Examples - Non-makeup Image",
46
+ examples_per_page=6)
47
+
48
+ makeup = gr.Image(source='upload', elem_id="image_upload", type="numpy",
49
+ label="Makeup Image")
50
+ gr.Examples(makeup_list, inputs=[makeup], label="Examples - Makeup Image", examples_per_page=6)
51
+
52
+ with gr.Column():
53
+ image_out = gr.Image(label="Output", type="numpy", elem_id="output-img").style(height=550)
54
+
55
+ # 영역별 투명도 슬라이더
56
+ alpha_eye = gr.Slider(0, 1, value=1, step=0.1, label="Eye Makeup Transparency (Alpha)")
57
+ alpha_eyebrow = gr.Slider(0, 1, value=1, step=0.1, label="Eyebrow Makeup Transparency (Alpha)")
58
+ alpha_lip = gr.Slider(0, 1, value=1, step=0.1, label="Lip Makeup Transparency (Alpha)")
59
+ alpha_all = gr.Slider(0, 1, value=1, step=0.1, label="Overall Makeup Transparency (Alpha)")
60
+
61
+ # 체크박스 그룹 (영역 선택)
62
+ region_selector = gr.CheckboxGroup(
63
+ ["eye", "eyebrow", "lip", "all"],
64
+ label="Select Makeup Regions",
65
+ value=["all"],
66
+ )
67
+
68
+ with gr.Row().style(mobile_collapse=False, equal_height=True):
69
+ btn = gr.Button("Apply Makeup! (CSD-MT)").style()
70
+
71
+ # Click result
72
+ btn.click(
73
+ fn=get_makeup_transfer_results256,
74
+ inputs=[
75
+ non_makeup,
76
+ makeup,
77
+ alpha_eye,
78
+ alpha_eyebrow,
79
+ alpha_lip,
80
+ alpha_all,
81
+ region_selector,
82
+ ],
83
+ outputs=image_out,
84
+ )
85
+
86
+
87
+ demo.launch()
88
+
gradle.properties ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Project-wide Gradle settings.
2
+ # IDE (e.g. Android Studio) users:
3
+ # Gradle settings configured through the IDE *will override*
4
+ # any settings specified in this file.
5
+ # For more details on how to configure your build environment visit
6
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
7
+ # Specifies the JVM arguments used for the daemon process.
8
+ # The setting is particularly useful for tweaking memory settings.
9
+ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10
+ # When configured, Gradle will run in incubating parallel mode.
11
+ # This option should only be used with decoupled projects. For more details, visit
12
+ # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13
+ # org.gradle.parallel=true
14
+ # AndroidX package structure to make it clearer which packages are bundled with the
15
+ # Android operating system, and which are packaged with your app's APK
16
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
17
+ android.useAndroidX=true
18
+ # Enables namespacing of each library's R class so that its R class includes only the
19
+ # resources declared in the library itself and none from the library's dependencies,
20
+ # thereby reducing the size of the R class for that library
21
+ android.nonTransitiveRClass=true
gradlew ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env sh
2
+
3
+ #
4
+ # Copyright 2015 the original author or authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ ##
21
+ ## Gradle start up script for UN*X
22
+ ##
23
+ ##############################################################################
24
+
25
+ # Attempt to set APP_HOME
26
+ # Resolve links: $0 may be a link
27
+ PRG="$0"
28
+ # Need this for relative symlinks.
29
+ while [ -h "$PRG" ] ; do
30
+ ls=`ls -ld "$PRG"`
31
+ link=`expr "$ls" : '.*-> \(.*\)$'`
32
+ if expr "$link" : '/.*' > /dev/null; then
33
+ PRG="$link"
34
+ else
35
+ PRG=`dirname "$PRG"`"/$link"
36
+ fi
37
+ done
38
+ SAVED="`pwd`"
39
+ cd "`dirname \"$PRG\"`/" >/dev/null
40
+ APP_HOME="`pwd -P`"
41
+ cd "$SAVED" >/dev/null
42
+
43
+ APP_NAME="Gradle"
44
+ APP_BASE_NAME=`basename "$0"`
45
+
46
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
50
+ MAX_FD="maximum"
51
+
52
+ warn () {
53
+ echo "$*"
54
+ }
55
+
56
+ die () {
57
+ echo
58
+ echo "$*"
59
+ echo
60
+ exit 1
61
+ }
62
+
63
+ # OS specific support (must be 'true' or 'false').
64
+ cygwin=false
65
+ msys=false
66
+ darwin=false
67
+ nonstop=false
68
+ case "`uname`" in
69
+ CYGWIN* )
70
+ cygwin=true
71
+ ;;
72
+ Darwin* )
73
+ darwin=true
74
+ ;;
75
+ MINGW* )
76
+ msys=true
77
+ ;;
78
+ NONSTOP* )
79
+ nonstop=true
80
+ ;;
81
+ esac
82
+
83
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+
86
+ # Determine the Java command to use to start the JVM.
87
+ if [ -n "$JAVA_HOME" ] ; then
88
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
+ # IBM's JDK on AIX uses strange locations for the executables
90
+ JAVACMD="$JAVA_HOME/jre/sh/java"
91
+ else
92
+ JAVACMD="$JAVA_HOME/bin/java"
93
+ fi
94
+ if [ ! -x "$JAVACMD" ] ; then
95
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
+
97
+ Please set the JAVA_HOME variable in your environment to match the
98
+ location of your Java installation."
99
+ fi
100
+ else
101
+ JAVACMD="java"
102
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
+
104
+ Please set the JAVA_HOME variable in your environment to match the
105
+ location of your Java installation."
106
+ fi
107
+
108
+ # Increase the maximum file descriptors if we can.
109
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
+ MAX_FD_LIMIT=`ulimit -H -n`
111
+ if [ $? -eq 0 ] ; then
112
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
+ MAX_FD="$MAX_FD_LIMIT"
114
+ fi
115
+ ulimit -n $MAX_FD
116
+ if [ $? -ne 0 ] ; then
117
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
118
+ fi
119
+ else
120
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
+ fi
122
+ fi
123
+
124
+ # For Darwin, add options to specify how the application appears in the dock
125
+ if $darwin; then
126
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
+ fi
128
+
129
+ # For Cygwin or MSYS, switch paths to Windows format before running java
130
+ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
+
134
+ JAVACMD=`cygpath --unix "$JAVACMD"`
135
+
136
+ # We build the pattern for arguments to be converted via cygpath
137
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
+ SEP=""
139
+ for dir in $ROOTDIRSRAW ; do
140
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
141
+ SEP="|"
142
+ done
143
+ OURCYGPATTERN="(^($ROOTDIRS))"
144
+ # Add a user-defined pattern to the cygpath arguments
145
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
+ fi
148
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
+ i=0
150
+ for arg in "$@" ; do
151
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
+
154
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
+ else
157
+ eval `echo args$i`="\"$arg\""
158
+ fi
159
+ i=`expr $i + 1`
160
+ done
161
+ case $i in
162
+ 0) set -- ;;
163
+ 1) set -- "$args0" ;;
164
+ 2) set -- "$args0" "$args1" ;;
165
+ 3) set -- "$args0" "$args1" "$args2" ;;
166
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
+ esac
173
+ fi
174
+
175
+ # Escape application args
176
+ save () {
177
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
+ echo " "
179
+ }
180
+ APP_ARGS=`save "$@"`
181
+
182
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
183
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
+
185
+ exec "$JAVACMD" "$@"
gradlew.bat ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%" == "" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%" == "" set DIRNAME=.
29
+ set APP_BASE_NAME=%~n0
30
+ set APP_HOME=%DIRNAME%
31
+
32
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
+
35
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
+
38
+ @rem Find java.exe
39
+ if defined JAVA_HOME goto findJavaFromJavaHome
40
+
41
+ set JAVA_EXE=java.exe
42
+ %JAVA_EXE% -version >NUL 2>&1
43
+ if "%ERRORLEVEL%" == "0" goto execute
44
+
45
+ echo.
46
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
+ echo.
48
+ echo Please set the JAVA_HOME variable in your environment to match the
49
+ echo location of your Java installation.
50
+
51
+ goto fail
52
+
53
+ :findJavaFromJavaHome
54
+ set JAVA_HOME=%JAVA_HOME:"=%
55
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
+
57
+ if exist "%JAVA_EXE%" goto execute
58
+
59
+ echo.
60
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
+ echo.
62
+ echo Please set the JAVA_HOME variable in your environment to match the
63
+ echo location of your Java installation.
64
+
65
+ goto fail
66
+
67
+ :execute
68
+ @rem Setup the command line
69
+
70
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
+
72
+
73
+ @rem Execute Gradle
74
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
+
76
+ :end
77
+ @rem End local scope for the variables with windows NT shell
78
+ if "%ERRORLEVEL%"=="0" goto mainEnd
79
+
80
+ :fail
81
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
+ rem the _cmd.exe /c_ return code!
83
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
+ exit /b 1
85
+
86
+ :mainEnd
87
+ if "%OS%"=="Windows_NT" endlocal
88
+
89
+ :omega
settings.gradle.kts ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pluginManagement {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ }
8
+
9
+ dependencyResolutionManagement {
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ }
15
+
16
+ rootProject.name = "Makeup" // 프로젝트 이름
17
+ include(":app") // 모듈 이름