diff --git a/lama_cleaner/plugins/gfpgan_plugin.py b/lama_cleaner/plugins/gfpgan_plugin.py index 17032fb..1b826f2 100644 --- a/lama_cleaner/plugins/gfpgan_plugin.py +++ b/lama_cleaner/plugins/gfpgan_plugin.py @@ -19,7 +19,7 @@ class GFPGANPlugin(BasePlugin): import facexlib if hasattr(facexlib.detection.retinaface, "device"): - facexlib.detection.retinaface.device = device + facexlib.detection.retinaface.device = "cpu" # Use GFPGAN for face enhancement self.face_enhancer = MyGFPGANer( @@ -30,6 +30,9 @@ class GFPGANPlugin(BasePlugin): device=device, bg_upsampler=upscaler.model if upscaler is not None else None, ) + self.face_enhancer.face_helper.face_det.mean_tensor.to("cpu") + self.face_enhancer.face_helper.face_det = self.face_enhancer.face_helper.face_det.to("cpu") + def __call__(self, rgb_np_img, files, form): weight = 0.5 diff --git a/lama_cleaner/server.py b/lama_cleaner/server.py index 29f6672..b03016a 100644 --- a/lama_cleaner/server.py +++ b/lama_cleaner/server.py @@ -376,8 +376,8 @@ def get_server_config(): return { "isControlNet": is_controlnet, "isDisableModelSwitchState": is_disable_model_switch, - "isEnableAutoSaving": is_enable_file_manager, - "enableFileManager": is_enable_auto_saving, + "isEnableAutoSaving": is_enable_auto_saving, + "enableFileManager": is_enable_file_manager, "plugins": list(plugins.keys()), }, 200 @@ -485,7 +485,7 @@ def main(args): is_controlnet = True output_dir = args.output_dir - if output_dir is not None: + if output_dir: is_enable_auto_saving = True device = torch.device(args.device) diff --git a/lama_cleaner/web_config.py b/lama_cleaner/web_config.py index c467299..93bae99 100644 --- a/lama_cleaner/web_config.py +++ b/lama_cleaner/web_config.py @@ -197,7 +197,7 @@ def main(config_file: str): enable_gif = gr.Checkbox(init_config.enable_gif, label=GIF_HELP) with gr.Tab("Diffusion Model"): - sd_local_model_path = gr.Checkbox( + sd_local_model_path = gr.Textbox( init_config.sd_local_model_path, label=f"{SD_LOCAL_MODEL_HELP}" ) sd_controlnet = gr.Checkbox(