From 1f2e19fa79015f49593c417b71082d0471b31458 Mon Sep 17 00:00:00 2001 From: Mohamad-Stability Date: Mon, 4 Nov 2024 23:44:59 +0200 Subject: [PATCH] fixed Aspect ratio for style reference --- stability_api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stability_api.py b/stability_api.py index 5adbca4..ac370a1 100644 --- a/stability_api.py +++ b/stability_api.py @@ -52,8 +52,9 @@ class StabilityBase: image = kwargs.get('image', None) if image is not None: - kwargs["mode"] = "image-to-image" - kwargs.pop("aspect_ratio", None) + if self.API_ENDPOINT not in ["stable-image/control/style", "stable-image/control/sketch", "stable-image/control/structure"]: + kwargs["mode"] = "image-to-image" + kwargs.pop("aspect_ratio", None) image = ToPILImage()(image.squeeze(0).permute(2,0,1)) image.save(buffered, format="PNG") files = self._get_files(buffered, **kwargs)