From 46a223f229c3458f0190813d48e1a52ed5a5ff5a Mon Sep 17 00:00:00 2001 From: Sean McLellan Date: Fri, 26 Aug 2022 04:05:09 -0400 Subject: [PATCH] Double check for null and 0, and add a comment to indicate intent --- ldm/simplet2i.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ldm/simplet2i.py b/ldm/simplet2i.py index 8aad3557af..dd99f5e6b6 100644 --- a/ldm/simplet2i.py +++ b/ldm/simplet2i.py @@ -305,9 +305,12 @@ class T2I: iter_images = next(images_iterator) for image in iter_images: try: - if gfpgan_strength > 0: - image = self._run_gfpgan( - image, gfpgan_strength + # if gfpgan strength is not none or less than 0.0 then don't use GFPGAN + # if the user specified -G x, and the --gfpgan wasn't specified, then + # the net result is a message gets printed - nothing else happens + if gfpgan_strength is not None and gfpgan_strength > 0.0: + image = self.gfpgan.generate( + image, gfpgan_strength=gfpgan_strength ) except Exception as e: print(