Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix extension related bugs #55

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ This is the parameter for [step-4](#step-4).
Specify whether to save the image before modification.
For more information, please see: [here](https://github.com/ototadana/sd-face-editor/issues/7#issuecomment-1505091410).

### Show intermediate steps (img2img only)
### Show intermediate steps
Specifies whether to display images of detected faces and masks.

### Apply scripts to faces
Expand Down
6 changes: 4 additions & 2 deletions scripts/face_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ def ui(self, is_img2img):

show_intermediate_steps = gr.Checkbox(
label="Show intermediate steps",
value=False,
visible=is_img2img)
value=False)

apply_scripts_to_faces = gr.Checkbox(
label="Apply scripts to faces",
Expand Down Expand Up @@ -221,6 +220,7 @@ def run(
max_face_count=max_face_count, mask_size=mask_size,
mask_blur=mask_blur, prompt_for_face=prompt_for_face,
apply_inside_mask_only=apply_inside_mask_only,
show_intermediate_steps=show_intermediate_steps,
apply_scripts_to_faces=apply_scripts_to_faces,
)

Expand All @@ -239,6 +239,7 @@ def proc_images(
mask_blur: int,
prompt_for_face: str,
apply_inside_mask_only: bool,
show_intermediate_steps: bool,
apply_scripts_to_faces: bool,
):
edited_images = []
Expand All @@ -265,6 +266,7 @@ def proc_images(
mask_blur=mask_blur, prompt_for_face=prompt_for_face,
apply_inside_mask_only=apply_inside_mask_only,
pre_proc_image=image,
show_intermediate_steps=show_intermediate_steps,
apply_scripts_to_faces=apply_scripts_to_faces)
edited_images.extend(proc.images)
res.images.extend(edited_images)
Expand Down
13 changes: 9 additions & 4 deletions scripts/face_editor_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,23 @@ def postprocess(self, o, res,
if not enabled or self.__is_running:
return

o.do_not_save_samples = False
script = face_editor.Script()
mask_model, detection_model = script.get_face_models()

try:
self.__is_running = True

if o.scripts is not None:
o.scripts.postprocess(o, res)

o.do_not_save_samples = False
script = face_editor.Script()
mask_model, detection_model = script.get_face_models()

script.proc_images(mask_model, detection_model, o, res,
face_margin=face_margin, confidence=confidence,
strength1=strength1, strength2=strength2,
max_face_count=max_face_count, mask_size=mask_size,
mask_blur=mask_blur, prompt_for_face=prompt_for_face,
apply_inside_mask_only=apply_inside_mask_only,
show_intermediate_steps=show_intermediate_steps,
apply_scripts_to_faces=apply_scripts_to_faces,
)

Expand Down