Fix CodeFormer not working if GFPGAN is enabeld

This commit is contained in:
blessedcoolant 2022-09-24 19:54:22 +12:00 committed by Lincoln Stein
parent 0678b24ebb
commit b1d1063a25

View File

@ -727,16 +727,16 @@ class Generate:
print(">> ESRGAN is disabled. Image not upscaled.")
if strength > 0:
if self.gfpgan is not None or self.codeformer is not None:
if facetool == 'gfpgan':
if self.gfpgan is None:
if facetool == 'codeformer':
if self.codeformer is not None:
image = self.codeformer.process(image=image, strength=strength, device=self.device, seed=seed, fidelity=codeformer_fidelity)
else:
print('>> CodeFormer not found. Face restoration is disabled.')
else:
print('>> GFPGAN not found. Face restoration is disabled.')
else:
image = self.gfpgan.process(image, strength, seed)
if facetool == 'codeformer':
if self.codeformer is None:
print('>> CodeFormer not found. Face restoration is disabled.')
else:
image = self.codeformer.process(image=image, strength=strength, device=self.device, seed=seed, fidelity=codeformer_fidelity)
else:
print(">> Face Restoration is disabled.")
except Exception as e: