Spaces:
Running
Running
app.py
CHANGED
@@ -24,7 +24,7 @@ def inference(file, mode):
|
|
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 +44,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,
|
|
|
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[0][:,:,::-1]
|
28 |
else:
|
29 |
model = {'name':'GPEN-1024-Color', 'size':1024}
|
30 |
grayf = cv2.imread(file, cv2.IMREAD_GRAYSCALE)
|
|
|
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="file", label="Output"),
|
48 |
title=title,
|
49 |
description=description,
|
50 |
article=article,
|