Fix error: global exception enhance() got an unexpected keyword argument 'weight'

#2
by aetherwu - opened
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -79,7 +79,10 @@ def inference(img, version, scale, weight):
79
  model_path='CodeFormer.pth', upscale=2, arch='CodeFormer', channel_multiplier=2, bg_upsampler=upsampler)
80
 
81
  try:
82
- _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True, weight=weight)
 
 
 
83
  except RuntimeError as error:
84
  print('Error', error)
85
 
 
79
  model_path='CodeFormer.pth', upscale=2, arch='CodeFormer', channel_multiplier=2, bg_upsampler=upsampler)
80
 
81
  try:
82
+ if version == 'RestoreFormer':
83
+ _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True, weight=weight)
84
+ else:
85
+ _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True)
86
  except RuntimeError as error:
87
  print('Error', error)
88