This commit is contained in:
Qing 2023-03-31 22:06:17 +08:00
parent a28cc4e34b
commit 6579977439
3 changed files with 8 additions and 5 deletions

View File

@ -19,7 +19,7 @@ class GFPGANPlugin(BasePlugin):
import facexlib import facexlib
if hasattr(facexlib.detection.retinaface, "device"): if hasattr(facexlib.detection.retinaface, "device"):
facexlib.detection.retinaface.device = device facexlib.detection.retinaface.device = "cpu"
# Use GFPGAN for face enhancement # Use GFPGAN for face enhancement
self.face_enhancer = MyGFPGANer( self.face_enhancer = MyGFPGANer(
@ -30,6 +30,9 @@ class GFPGANPlugin(BasePlugin):
device=device, device=device,
bg_upsampler=upscaler.model if upscaler is not None else None, 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): def __call__(self, rgb_np_img, files, form):
weight = 0.5 weight = 0.5

View File

@ -376,8 +376,8 @@ def get_server_config():
return { return {
"isControlNet": is_controlnet, "isControlNet": is_controlnet,
"isDisableModelSwitchState": is_disable_model_switch, "isDisableModelSwitchState": is_disable_model_switch,
"isEnableAutoSaving": is_enable_file_manager, "isEnableAutoSaving": is_enable_auto_saving,
"enableFileManager": is_enable_auto_saving, "enableFileManager": is_enable_file_manager,
"plugins": list(plugins.keys()), "plugins": list(plugins.keys()),
}, 200 }, 200
@ -485,7 +485,7 @@ def main(args):
is_controlnet = True is_controlnet = True
output_dir = args.output_dir output_dir = args.output_dir
if output_dir is not None: if output_dir:
is_enable_auto_saving = True is_enable_auto_saving = True
device = torch.device(args.device) device = torch.device(args.device)

View File

@ -197,7 +197,7 @@ def main(config_file: str):
enable_gif = gr.Checkbox(init_config.enable_gif, label=GIF_HELP) enable_gif = gr.Checkbox(init_config.enable_gif, label=GIF_HELP)
with gr.Tab("Diffusion Model"): 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}" init_config.sd_local_model_path, label=f"{SD_LOCAL_MODEL_HELP}"
) )
sd_controlnet = gr.Checkbox( sd_controlnet = gr.Checkbox(