Skip to content

Commit

Permalink
Merge pull request #83 from glucauze/v1.2.6
Browse files Browse the repository at this point in the history
fix inpainting in auto dev version
  • Loading branch information
glucauze committed Aug 31, 2023
2 parents 806086b + bf8ef5e commit 0d0242e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,32 @@ More on this here : https://glucauze.github.io/sd-webui-faceswaplab/

## Quick Start

Here are some gifs to explain (non cherry picked, just random pictures) :

## Simple Usage (roop like)

This use codeformer on all faces (including non swapped)

[simple.webm](https://github.com/glucauze/sd-webui-faceswaplab/assets/137925069/de00b685-d441-44f9-bae3-71cd7abef113)

## Advanced options

This is use to improve results. This use upscaling and codeformer only on swapped faces

[advanced.webm](https://github.com/glucauze/sd-webui-faceswaplab/assets/137925069/50630311-bd25-487f-871b-0a44eecd435d)

## Inpainting

This add inpainting on faces :

[inpainting.webm](https://github.com/glucauze/sd-webui-faceswaplab/assets/137925069/3d3508e9-5be4-4566-8c41-8301b2d08355)

## Build and use checkpoints :

[build.webm](https://github.com/glucauze/sd-webui-faceswaplab/assets/137925069/e84e9a3c-840d-4536-9fbb-09ed256406d7)



### Simple

1. Put a face in the reference.
Expand Down
7 changes: 0 additions & 7 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@

def check_install() -> None:
use_gpu = True
try:
from modules import shared

use_gpu = not getattr(shared.cmd_opts, "use-cpu", False)
except:
# On some platform previous lines may failed (modules.shared not initialized), just ignore and use GPU requirements
pass

if use_gpu and sys.platform != "darwin":
print("Faceswaplab : Use GPU requirements")
Expand Down
13 changes: 2 additions & 11 deletions scripts/faceswaplab_inpainting/i2i_pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def img2img_diffusion(
)

i2i_kwargs = {
"init_images": [img],
"sampler_name": options.inpainting_sampler,
"do_not_save_samples": True,
"steps": options.inpainting_steps,
Expand All @@ -65,24 +66,14 @@ def img2img_diffusion(
"denoising_strength": options.inpainting_denoising_strengh,
"seed": options.inpainting_seed,
}
# Remove the following as they are not always supported on all platform :
# "override_settings": {
# "return_mask_composite": False,
# "save_images_before_face_restoration": False,
# "save_images_before_highres_fix": False,
# "save_images_before_color_correction": False,
# "save_mask": False,
# "save_mask_composite": False,
# "samples_save": False,
# },

current_model_checkpoint = shared.opts.sd_model_checkpoint
if options.inpainting_model and options.inpainting_model != "Current":
# Change checkpoint
shared.opts.sd_model_checkpoint = options.inpainting_model
sd_models.select_checkpoint
sd_models.load_model()
i2i_p = StableDiffusionProcessingImg2Img([img], **i2i_kwargs)
i2i_p = StableDiffusionProcessingImg2Img(**i2i_kwargs)
i2i_processed = processing.process_images(i2i_p)
if options.inpainting_model and options.inpainting_model != "Current":
# Restore checkpoint
Expand Down
3 changes: 1 addition & 2 deletions scripts/faceswaplab_ui/faceswaplab_postprocessing_ui.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import List
import gradio as gr
import modules
from modules import shared, sd_models
from modules import shared
from scripts.faceswaplab_postprocessing.postprocessing_options import InpaintingWhen
from scripts.faceswaplab_utils.sd_utils import get_sd_option
from scripts.faceswaplab_ui.faceswaplab_inpainting_ui import face_inpainting_ui
Expand Down

0 comments on commit 0d0242e

Please sign in to comment.