Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,13 +100,13 @@ def inference(file, mode):
|
|
| 100 |
cv2.imwrite(os.path.join("output.png"), colorf)
|
| 101 |
return os.path.join("output.png")
|
| 102 |
elif mode == "inpainting":
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
model = {'name':'GPEN-Inpainting-1024', 'size':1024}
|
| 107 |
faceinpainter = FaceInpainting(size=model['size'], model=model['name'], channel_multiplier=2, device='cpu')
|
| 108 |
-
im = np.asarray(brush_stroke_mask(Image.fromarray(
|
| 109 |
-
inpaint = faceinpainter.process(
|
| 110 |
|
| 111 |
cv2.imwrite(os.path.join("output.png"), inpaint)
|
| 112 |
return os.path.join("output.png")
|
|
|
|
| 100 |
cv2.imwrite(os.path.join("output.png"), colorf)
|
| 101 |
return os.path.join("output.png")
|
| 102 |
elif mode == "inpainting":
|
| 103 |
+
im1 = cv2.imread(file, cv2.IMREAD_COLOR)
|
| 104 |
+
im2 = imutils.resize(im1, width=1024)
|
| 105 |
+
im3 = cv2.resize(im2, (0,0), fx=3, fy=3)
|
| 106 |
model = {'name':'GPEN-Inpainting-1024', 'size':1024}
|
| 107 |
faceinpainter = FaceInpainting(size=model['size'], model=model['name'], channel_multiplier=2, device='cpu')
|
| 108 |
+
im = np.asarray(brush_stroke_mask(Image.fromarray(im3)))
|
| 109 |
+
inpaint = faceinpainter.process(im3)
|
| 110 |
|
| 111 |
cv2.imwrite(os.path.join("output.png"), inpaint)
|
| 112 |
return os.path.join("output.png")
|