Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -125,24 +125,9 @@ def extract_canny(input_image):
|
|
125 |
|
126 |
|
127 |
def convert_to_grayscale(image):
|
128 |
-
|
129 |
-
gray_image = convert_from_cv2_to_image(cv2.cvtColor(image, cv2.COLOR_BGR2GRAY))
|
130 |
return gray_image
|
131 |
|
132 |
-
def tile_old(input_image, resolution=768):
|
133 |
-
input_image = convert_from_image_to_cv2(input_image)
|
134 |
-
H, W, C = input_image.shape
|
135 |
-
H = float(H)
|
136 |
-
W = float(W)
|
137 |
-
k = float(resolution) / min(H, W)
|
138 |
-
H *= k
|
139 |
-
W *= k
|
140 |
-
H = int(np.round(H / 16.0)) * 16
|
141 |
-
W = int(np.round(W / 16.0)) * 16
|
142 |
-
img = cv2.resize(input_image, (W, H), interpolation=cv2.INTER_LANCZOS4 if k > 1 else cv2.INTER_AREA)
|
143 |
-
img = convert_from_cv2_to_image(img)
|
144 |
-
return img
|
145 |
-
|
146 |
def tile(downscale_factor, input_image):
|
147 |
control_image = input_image.resize((input_image.size[0] // downscale_factor, input_image.size[1] // downscale_factor)).resize(input_image.size, Image.NEAREST)
|
148 |
return control_image
|
|
|
125 |
|
126 |
|
127 |
def convert_to_grayscale(image):
|
128 |
+
gray_image = image.convert('L').convert('RGB')
|
|
|
129 |
return gray_image
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
def tile(downscale_factor, input_image):
|
132 |
control_image = input_image.resize((input_image.size[0] // downscale_factor, input_image.size[1] // downscale_factor)).resize(input_image.size, Image.NEAREST)
|
133 |
return control_image
|