Spaces:
Running
on
Zero
Running
on
Zero
Update kontext_pipeline.py
Browse files- kontext_pipeline.py +2 -0
kontext_pipeline.py
CHANGED
@@ -942,12 +942,14 @@ class FluxKontextPipeline(
|
|
942 |
image_width, image_height = self.image_processor.get_default_height_width(image[0])
|
943 |
else:
|
944 |
image_width, image_height = self.image_processor.get_default_height_width(image)
|
|
|
945 |
aspect_ratio = image_width / image_height
|
946 |
if _auto_resize:
|
947 |
# Kontext is trained on specific resolutions, using one of them is recommended
|
948 |
_, image_width, image_height = min(
|
949 |
(abs(aspect_ratio - w / h), w, h) for w, h in PREFERRED_KONTEXT_RESOLUTIONS
|
950 |
)
|
|
|
951 |
image_width = image_width // multiple_of * multiple_of
|
952 |
image_height = image_height // multiple_of * multiple_of
|
953 |
image = self.image_processor.resize(image, image_height, image_width)
|
|
|
942 |
image_width, image_height = self.image_processor.get_default_height_width(image[0])
|
943 |
else:
|
944 |
image_width, image_height = self.image_processor.get_default_height_width(image)
|
945 |
+
print("orig width, height:", image_width, image_height)
|
946 |
aspect_ratio = image_width / image_height
|
947 |
if _auto_resize:
|
948 |
# Kontext is trained on specific resolutions, using one of them is recommended
|
949 |
_, image_width, image_height = min(
|
950 |
(abs(aspect_ratio - w / h), w, h) for w, h in PREFERRED_KONTEXT_RESOLUTIONS
|
951 |
)
|
952 |
+
print("new width, height:", image_width, image_height)
|
953 |
image_width = image_width // multiple_of * multiple_of
|
954 |
image_height = image_height // multiple_of * multiple_of
|
955 |
image = self.image_processor.resize(image, image_height, image_width)
|