diff --git a/scripts/inferencers/img2img_face_processor.py b/scripts/inferencers/img2img_face_processor.py index e1be96a..cbed6ad 100644 --- a/scripts/inferencers/img2img_face_processor.py +++ b/scripts/inferencers/img2img_face_processor.py @@ -1,8 +1,8 @@ from typing import Union -from modules.processing import StableDiffusionProcessingImg2Img, process_images from PIL import Image +from modules.processing import StableDiffusionProcessingImg2Img, process_images from scripts.entities.face import Face from scripts.use_cases.face_processor import FaceProcessor @@ -36,10 +36,17 @@ def process( refiner_switch_at = p.refiner_switch_at p.refiner_switch_at = 0 + has_hr_checkpoint_name = p.enable_hr and hasattr(p, "hr_checkpoint_name") and p.hr_checkpoint_name is not None and hasattr(p, "override_settings") + if has_hr_checkpoint_name: + backup_sd_model_checkpoint = p.override_settings.get("sd_model_checkpoint", None) + p.override_settings["sd_model_checkpoint"] = p.hr_checkpoint_name + print(f"prompt for the {face.face_area.tag}: {p.prompt}") proc = process_images(p) if use_refiner_model_only: p.refiner_switch_at = refiner_switch_at + if has_hr_checkpoint_name: + p.override_settings["sd_model_checkpoint"] = backup_sd_model_checkpoint return proc.images[0]