Spaces:
Running
Running
app.py
CHANGED
@@ -20,11 +20,10 @@ def inference(file, mode):
|
|
20 |
|
21 |
if mode == "enhance":
|
22 |
model = {'name':'GPEN-512', 'size':512}
|
23 |
-
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
24 |
-
im = cv2.resize(im, (0,0), fx=2, fy=2)
|
25 |
faceenhancer = FaceEnhancement(size=model['size'], model=model['name'], channel_multiplier=2, device='cpu')
|
26 |
img, orig_faces, enhanced_faces = faceenhancer.process(im)
|
27 |
-
return img
|
28 |
else:
|
29 |
model = {'name':'GPEN-1024-Color', 'size':1024}
|
30 |
grayf = cv2.imread(file, cv2.IMREAD_GRAYSCALE)
|
@@ -44,7 +43,7 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2105.060
|
|
44 |
gr.Interface(
|
45 |
inference,
|
46 |
[gr.inputs.Image(type="filepath", label="Input"),gr.inputs.Radio(["enhance","colorize"], type="value", default="enhance", label="model type")],
|
47 |
-
gr.outputs.Image(type="
|
48 |
title=title,
|
49 |
description=description,
|
50 |
article=article,
|
|
|
20 |
|
21 |
if mode == "enhance":
|
22 |
model = {'name':'GPEN-512', 'size':512}
|
23 |
+
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
|
|
24 |
faceenhancer = FaceEnhancement(size=model['size'], model=model['name'], channel_multiplier=2, device='cpu')
|
25 |
img, orig_faces, enhanced_faces = faceenhancer.process(im)
|
26 |
+
return img
|
27 |
else:
|
28 |
model = {'name':'GPEN-1024-Color', 'size':1024}
|
29 |
grayf = cv2.imread(file, cv2.IMREAD_GRAYSCALE)
|
|
|
43 |
gr.Interface(
|
44 |
inference,
|
45 |
[gr.inputs.Image(type="filepath", label="Input"),gr.inputs.Radio(["enhance","colorize"], type="value", default="enhance", label="model type")],
|
46 |
+
gr.outputs.Image(type="numpy", label="Output"),
|
47 |
title=title,
|
48 |
description=description,
|
49 |
article=article,
|