From 062f3e8f314f859b2abe0497856261dbef0af75d Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sun, 18 Sep 2022 14:42:43 -0400 Subject: [PATCH] Gfpgan download fix (#655) * restore ability to save files to directories named after prompt * don't download gfpgan model file if it exists - Fixes #647 --- scripts/preload_models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/preload_models.py b/scripts/preload_models.py index 794a552134..08a4b7440b 100755 --- a/scripts/preload_models.py +++ b/scripts/preload_models.py @@ -89,8 +89,9 @@ if gfpgan: import urllib.request model_path = 'https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth' model_dest = 'src/gfpgan/experiments/pretrained_models/GFPGANv1.3.pth' - print('downloading gfpgan model file...') - urllib.request.urlretrieve(model_path,model_dest) + if not os.path.exists(model_dest): + print('downloading gfpgan model file...') + urllib.request.urlretrieve(model_path,model_dest) except Exception: import traceback print('Error loading GFPGAN:')