Skip to content

Commit 93c242c

Browse files
committed
make gfpgan_model_exists flag available to web interface
1 parent c7c6cd7 commit 93c242c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ldm/gfpgan/gfpgan_tools.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
arg_parser = create_argv_parser()
1111
opt = arg_parser.parse_args()
12+
model_path = os.path.join(opt.gfpgan_dir, opt.gfpgan_model_path)
13+
gfpgan_model_exists = os.path.isfile(model_path)
1214

1315
def run_gfpgan(image, strength, seed, upsampler_scale=4):
1416
print(f'>> GFPGAN - Restoring Faces for image seed:{seed}')
@@ -17,9 +19,6 @@ def run_gfpgan(image, strength, seed, upsampler_scale=4):
1719
warnings.filterwarnings('ignore', category=DeprecationWarning)
1820
warnings.filterwarnings('ignore', category=UserWarning)
1921

20-
model_path = os.path.join(opt.gfpgan_dir, opt.gfpgan_model_path)
21-
gfpgan_model_exists = os.path.isfile(model_path)
22-
2322
try:
2423
if not gfpgan_model_exists:
2524
raise Exception('GFPGAN model not found at path ' + model_path)

0 commit comments

Comments
 (0)