Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,6 +19,7 @@ import cv2
|
|
19 |
import glob
|
20 |
import time
|
21 |
import math
|
|
|
22 |
import argparse
|
23 |
import numpy as np
|
24 |
from PIL import Image, ImageDraw
|
@@ -99,6 +100,9 @@ def inference(file, mode):
|
|
99 |
cv2.imwrite(os.path.join("output.png"), colorf)
|
100 |
return os.path.join("output.png")
|
101 |
elif mode == "inpainting":
|
|
|
|
|
|
|
102 |
model = {'name':'GPEN-Inpainting-1024', 'size':1024}
|
103 |
faceinpainter = FaceInpainting(size=model['size'], model=model['name'], channel_multiplier=2, device='cpu')
|
104 |
im = np.asarray(brush_stroke_mask(Image.fromarray(im)))
|
|
|
19 |
import glob
|
20 |
import time
|
21 |
import math
|
22 |
+
import imutils
|
23 |
import argparse
|
24 |
import numpy as np
|
25 |
from PIL import Image, ImageDraw
|
|
|
100 |
cv2.imwrite(os.path.join("output.png"), colorf)
|
101 |
return os.path.join("output.png")
|
102 |
elif mode == "inpainting":
|
103 |
+
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
104 |
+
im = imutils.resize(im, width=1024)
|
105 |
+
im = cv2.resize(im, (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(im)))
|