From 93c242c9fbef91d87a6bbf42db2267dbd51e5739 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sun, 11 Sep 2022 14:47:58 -0400 Subject: [PATCH] make gfpgan_model_exists flag available to web interface --- ldm/gfpgan/gfpgan_tools.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ldm/gfpgan/gfpgan_tools.py b/ldm/gfpgan/gfpgan_tools.py index dd0e8657c2..f76790fc08 100644 --- a/ldm/gfpgan/gfpgan_tools.py +++ b/ldm/gfpgan/gfpgan_tools.py @@ -9,6 +9,8 @@ from scripts.dream import create_argv_parser arg_parser = create_argv_parser() opt = arg_parser.parse_args() +model_path = os.path.join(opt.gfpgan_dir, opt.gfpgan_model_path) +gfpgan_model_exists = os.path.isfile(model_path) def run_gfpgan(image, strength, seed, upsampler_scale=4): print(f'>> GFPGAN - Restoring Faces for image seed:{seed}') @@ -17,9 +19,6 @@ def run_gfpgan(image, strength, seed, upsampler_scale=4): warnings.filterwarnings('ignore', category=DeprecationWarning) warnings.filterwarnings('ignore', category=UserWarning) - model_path = os.path.join(opt.gfpgan_dir, opt.gfpgan_model_path) - gfpgan_model_exists = os.path.isfile(model_path) - try: if not gfpgan_model_exists: raise Exception('GFPGAN model not found at path ' + model_path)