Spaces:
Running
Running
avoid upscale for large img.
Browse files114 unmodified lines1151161171181191201211221231247 unmodified lines132133134135136137138114 unmodified linesprint('\timage size:', img.shape)upscale = int(upscale) # covert type to intif upscale > 4:upscale = 4 # avoid momory exceeded due to too large upscaleif upscale > 2 and max(img.shape[:2])>1000:upscale = 2 # avoid momory exceeded due to too large img resolutionface_helper = FaceRestoreHelper(upscale,7 unmodified linesbg_upsampler = upsampler if background_enhance else Noneface_upsampler = upsampler if face_upsample else Noneif has_aligned:# the input faces are already cropped and alignedimg = cv2.resize(img, (512, 512), interpolation=cv2.INTER_LINEAR)114 unmodified lines1151161171181191201211221231241251261271287 unmodified lines136137138139140141114 unmodified linesprint('\timage size:', img.shape)upscale = int(upscale) # covert type to intif upscale > 4: # avoid momory exceeded due to too large upscaleupscale = 4if upscale > 2 and max(img.shape[:2])>1000: # avoid momory exceeded due to too large img resolutionupscale = 2if max(img.shape[:2]) > 1500: # avoid momory exceeded due to too large img resolutionupscale = 1background_enhance = Falseface_upsample = Falseface_helper = FaceRestoreHelper(upscale,7 unmodified linesbg_upsampler = upsampler if background_enhance else Noneface_upsampler = upsampler if face_upsample else Noneif has_aligned:# the input faces are already cropped and alignedimg = cv2.resize(img, (512, 512), interpolation=cv2.INTER_LINEAR)
app.py+8-5