Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ from face_colorization import FaceColorization
|
|
20 |
def inference(file, mode):
|
21 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
22 |
im = cv2.resize(im, (0,0), fx=2, fy=2)
|
23 |
-
faceenhancer = FaceEnhancement(size=512, model='GPEN-512', channel_multiplier=2, device='
|
24 |
img, orig_faces, enhanced_faces = faceenhancer.process(im)
|
25 |
|
26 |
if mode == "enhance":
|
@@ -35,7 +35,7 @@ def inference(file, mode):
|
|
35 |
model = {'name':'GPEN-1024-Color', 'size':1024}
|
36 |
grayf = cv2.imread("enhanced.png", cv2.IMREAD_GRAYSCALE)
|
37 |
grayf = cv2.cvtColor(grayf, cv2.COLOR_GRAY2BGR) # channel: 1->3
|
38 |
-
facecolorizer = FaceColorization(size=model['size'], model=model['name'], channel_multiplier=2, device='
|
39 |
colorf = facecolorizer.process(grayf)
|
40 |
|
41 |
colorf = cv2.resize(colorf, (grayf.shape[1], grayf.shape[0]))
|
|
|
20 |
def inference(file, mode):
|
21 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
22 |
im = cv2.resize(im, (0,0), fx=2, fy=2)
|
23 |
+
faceenhancer = FaceEnhancement(size=512, model='GPEN-512', channel_multiplier=2, device='cuda')
|
24 |
img, orig_faces, enhanced_faces = faceenhancer.process(im)
|
25 |
|
26 |
if mode == "enhance":
|
|
|
35 |
model = {'name':'GPEN-1024-Color', 'size':1024}
|
36 |
grayf = cv2.imread("enhanced.png", cv2.IMREAD_GRAYSCALE)
|
37 |
grayf = cv2.cvtColor(grayf, cv2.COLOR_GRAY2BGR) # channel: 1->3
|
38 |
+
facecolorizer = FaceColorization(size=model['size'], model=model['name'], channel_multiplier=2, device='cuda')
|
39 |
colorf = facecolorizer.process(grayf)
|
40 |
|
41 |
colorf = cv2.resize(colorf, (grayf.shape[1], grayf.shape[0]))
|