Spaces:
Sleeping
Sleeping
add upscale limit.
Browse files108 unmodified lines1091101111121131141151168 unmodified lines125126127128129130110 unmodified lines241242243244245246247248108 unmodified linesonly_center_face = Falsedraw_box = Falsedetection_model = "retinaface_resnet50"upscale = int(upscale) # covert type to intface_helper = FaceRestoreHelper(upscale,face_size=512,8 unmodified linesimg = cv2.imread(str(image), cv2.IMREAD_COLOR)if has_aligned:# the input faces are already cropped and alignedimg = cv2.resize(img, (512, 512), interpolation=cv2.INTER_LINEAR)110 unmodified linesgr.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.outputs.Image(type="numpy", label="Output"),gr.outputs.File(label="Download the output")108 unmodified lines1091101111121131141151161171181191208 unmodified lines129130131132133134135136110 unmodified lines247248249250251252253254108 unmodified linesonly_center_face = Falsedraw_box = Falsedetection_model = "retinaface_resnet50"print(image, background_enhance, face_upsample, upscale, codeformer_fidelity)upscale = int(upscale) # covert type to intif upscale > 4:upscale = 4 # avoid momory exceeded due to too large upscaleface_helper = FaceRestoreHelper(upscale,face_size=512,8 unmodified linesimg = cv2.imread(str(image), cv2.IMREAD_COLOR)print('Image size:', img.shape)if has_aligned:# the input faces are already cropped and alignedimg = cv2.resize(img, (512, 512), interpolation=cv2.INTER_LINEAR)110 unmodified linesgr.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 (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