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
This commit is contained in:
Lincoln Stein 2022-09-18 14:42:43 -04:00 committed by GitHub
parent 3c4c4d71c9
commit 062f3e8f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,6 +89,7 @@ if gfpgan:
import urllib.request import urllib.request
model_path = 'https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth' 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' model_dest = 'src/gfpgan/experiments/pretrained_models/GFPGANv1.3.pth'
if not os.path.exists(model_dest):
print('downloading gfpgan model file...') print('downloading gfpgan model file...')
urllib.request.urlretrieve(model_path,model_dest) urllib.request.urlretrieve(model_path,model_dest)
except Exception: except Exception: