Skip to content

Commit

Permalink
make gfpgan_model_exists flag available to web interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lstein committed Sep 11, 2022
1 parent c7c6cd7 commit 93c242c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ldm/gfpgan/gfpgan_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

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}')
Expand All @@ -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)
Expand Down

0 comments on commit 93c242c

Please sign in to comment.