Spaces:
Running
on
Zero
Running
on
Zero
Update model.py
Browse files
model.py
CHANGED
|
@@ -122,7 +122,7 @@ class Model:
|
|
| 122 |
).images
|
| 123 |
|
| 124 |
|
| 125 |
-
def resize_image(image):
|
| 126 |
image = image.convert('RGB')
|
| 127 |
current_size = image.size
|
| 128 |
if current_size[0] > current_size[1]:
|
|
@@ -132,7 +132,7 @@ class Model:
|
|
| 132 |
resized_image = transforms.functional.resize(center_cropped_image, (1024, 1024))
|
| 133 |
return resized_image
|
| 134 |
|
| 135 |
-
def get_canny_filter(image):
|
| 136 |
low_threshold = 100
|
| 137 |
high_threshold = 200
|
| 138 |
|
|
@@ -160,9 +160,9 @@ class Model:
|
|
| 160 |
) -> list[PIL.Image.Image]:
|
| 161 |
|
| 162 |
# resize input_image to 1024x1024
|
| 163 |
-
input_image = resize_image(image)
|
| 164 |
|
| 165 |
-
canny_image = get_canny_filter(input_image)
|
| 166 |
|
| 167 |
self.load_controlnet_weight("Canny")
|
| 168 |
results = self.run_pipe(
|
|
|
|
| 122 |
).images
|
| 123 |
|
| 124 |
|
| 125 |
+
def resize_image(self, image):
|
| 126 |
image = image.convert('RGB')
|
| 127 |
current_size = image.size
|
| 128 |
if current_size[0] > current_size[1]:
|
|
|
|
| 132 |
resized_image = transforms.functional.resize(center_cropped_image, (1024, 1024))
|
| 133 |
return resized_image
|
| 134 |
|
| 135 |
+
def get_canny_filter(self, image):
|
| 136 |
low_threshold = 100
|
| 137 |
high_threshold = 200
|
| 138 |
|
|
|
|
| 160 |
) -> list[PIL.Image.Image]:
|
| 161 |
|
| 162 |
# resize input_image to 1024x1024
|
| 163 |
+
input_image = self.resize_image(image)
|
| 164 |
|
| 165 |
+
canny_image = self.get_canny_filter(input_image)
|
| 166 |
|
| 167 |
self.load_controlnet_weight("Canny")
|
| 168 |
results = self.run_pipe(
|