Spaces:
Sleeping
Sleeping
add upscale limit.
Browse files108 unmodified lines1091101111121131141151161171181191208 unmodified lines129130131132133134135136110 unmodified lines247248249244245250251252253254108 unmodified lines only_center_face = False draw_box = False detection_model = "retinaface_resnet50" print(image, background_enhance, face_upsample, upscale, codeformer_fidelity)
upscale = int(upscale) # covert type to int if upscale > 4: upscale = 4 # avoid momory exceeded due to too large upscale
face_helper = FaceRestoreHelper( upscale, face_size=512,8 unmodified lines
img = cv2.imread(str(image), cv2.IMREAD_COLOR)
print('Image size:', img.shape)
if has_aligned: # the input faces are already cropped and aligned img = cv2.resize(img, (512, 512), interpolation=cv2.INTER_LINEAR)110 unmodified lines gr.inputs.Image(type="filepath", label="Input"), gr.inputs.Checkbox(default=True, label="Background_Enhance"), gr.inputs.Checkbox(default=True, label="Face_Upsample"), gr.inputs.Number(default=2, label="Rescaling_Factor"), gr.Slider(0, 1, value=0.5, step=0.01, label='Codeformer_Fidelity: 0 for better quality, 1 for better identity') gr.inputs.Number(default=2, label="Rescaling_Factor (up to 4)"), gr.Slider(0, 1, value=0.5, step=0.01, label='Codeformer_Fidelity: 0 better quality, 1 better identity') ], [ gr.outputs.Image(type="numpy", label="Output"), gr.outputs.File(label="Download the output")app.py+8-2