From 08aba2cdb6c252479805ea9eea6fb69e4cf4ea7f Mon Sep 17 00:00:00 2001
From: Gourieff <777@lovemet.ru>
Date: Thu, 31 Aug 2023 15:09:11 +0700
Subject: [PATCH] UPDATE: UI rework
+ Inpaint info update
+ VersionUP (beta2)
---
README.md | 4 +-
README_RU.md | 4 +-
scripts/faceswap.py | 110 ++++++++++++++++++++++----------------------
scripts/version.py | 2 +-
4 files changed, 61 insertions(+), 59 deletions(-)
diff --git a/README.md b/README.md
index 3056829..73c2c6b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
- 
+ 
[](https://github.com/Gourieff/sd-webui-reactor/commits/main)

[](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0)
@@ -118,7 +118,7 @@ Select the face numbers you wish to swap using the "Comma separated face number(
You can choose to activate the swap on the source image or on the generated image, or on both using the checkboxes. Activating on source image allows you to start from a given base and apply the diffusion process to it.
-ReActor works with Inpainting - but only the masked part will be swapped.
Please use with the "Only masked" option for "Inpaint area" if you enabled "Upscaler".
+ReActor works with Inpainting - but only the masked part will be swapped.
Please use with the "Only masked" option for "Inpaint area" if you enabled "Upscaler". Otherwise use the upscale option via the Extras tab or via the Script loader (below the screen) with "SD upscale" or "Ultimate SD upscale".
## API
diff --git a/README_RU.md b/README_RU.md
index c5950a9..cc8c67a 100644
--- a/README_RU.md
+++ b/README_RU.md
@@ -2,7 +2,7 @@
- 
+ 
[](https://github.com/Gourieff/sd-webui-reactor/commits/main)

[](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0)
@@ -118,7 +118,7 @@
Используйте эту вкладку, чтобы заменить лицо на уже готовом изображении (флажок "Swap in source image") или на сгенерированном на основе готового (флажок "Swap in generated image").
-Inpainting также работает, но замена лица происходит только в области маски.
Пожалуйста, используйте с опцией "Only masked" для "Inpaint area", если вы применяете "Upscaler".
+Inpainting также работает, но замена лица происходит только в области маски.
Пожалуйста, используйте с опцией "Only masked" для "Inpaint area", если вы применяете "Upscaler". Иначе, используйте функцию увеличения (апскейла) через вкладку "Extras" или через опциональный загрузчик "Script" (внизу экрана), применив "SD upscale" или "Ultimate SD upscale".
## API
diff --git a/scripts/faceswap.py b/scripts/faceswap.py
index 7f03061..5e59e13 100644
--- a/scripts/faceswap.py
+++ b/scripts/faceswap.py
@@ -44,48 +44,61 @@ class FaceSwapScript(scripts.Script):
def ui(self, is_img2img):
with gr.Accordion(f"{app_title}", open=False):
- with gr.Column():
- img = gr.inputs.Image(type="pil")
- enable = gr.Checkbox(False, label="Enable", info=f"The Fast and Simple \"roop-based\" FaceSwap Extension - {version_flag}")
- gr.Markdown("---")
- gr.Markdown("Source Image (above):")
- with gr.Row():
- source_faces_index = gr.Textbox(
- value="0",
- placeholder="Which face(s) to use as Source (comma separated)",
- label="Comma separated face number(s); Example: 0,2,1",
- )
- gender_source = gr.Radio(
- ["No", "Female Only", "Male Only"],
- value="No",
- label="Gender Detection (Source)",
- type="index",
- )
- gr.Markdown("---")
- gr.Markdown("Target Image (result):")
- with gr.Row():
- faces_index = gr.Textbox(
- value="0",
- placeholder="Which face(s) to Swap into Target (comma separated)",
- label="Comma separated face number(s); Example: 1,0,2",
- )
- gender_target = gr.Radio(
- ["No", "Female Only", "Male Only"],
- value="No",
- label="Gender Detection (Target)",
- type="index",
- )
- gr.Markdown("---")
- with gr.Row():
- face_restorer_name = gr.Radio(
- label="Restore Face",
- choices=["None"] + [x.name() for x in shared.face_restorers],
- value=shared.face_restorers[0].name(),
- type="value",
- )
- face_restorer_visibility = gr.Slider(
- 0, 1, 1, step=0.1, label="Restore Face Visibility"
+ with gr.Tab("Input"):
+ with gr.Column():
+ img = gr.inputs.Image(type="pil")
+ enable = gr.Checkbox(False, label="Enable", info=f"The Fast and Simple FaceSwap Extension - {version_flag}")
+ gr.Markdown("
")
+ gr.Markdown("Source Image (above):")
+ with gr.Row():
+ source_faces_index = gr.Textbox(
+ value="0",
+ placeholder="Which face(s) to use as Source (comma separated)",
+ label="Comma separated face number(s); Example: 0,2,1",
+ )
+ gender_source = gr.Radio(
+ ["No", "Female Only", "Male Only"],
+ value="No",
+ label="Gender Detection (Source)",
+ type="index",
+ )
+ gr.Markdown("
")
+ gr.Markdown("Target Image (result):")
+ with gr.Row():
+ faces_index = gr.Textbox(
+ value="0",
+ placeholder="Which face(s) to Swap into Target (comma separated)",
+ label="Comma separated face number(s); Example: 1,0,2",
+ )
+ gender_target = gr.Radio(
+ ["No", "Female Only", "Male Only"],
+ value="No",
+ label="Gender Detection (Target)",
+ type="index",
+ )
+ gr.Markdown("
")
+ with gr.Row():
+ face_restorer_name = gr.Radio(
+ label="Restore Face",
+ choices=["None"] + [x.name() for x in shared.face_restorers],
+ value=shared.face_restorers[0].name(),
+ type="value",
+ )
+ face_restorer_visibility = gr.Slider(
+ 0, 1, 1, step=0.1, label="Restore Face Visibility"
+ )
+ gr.Markdown("
")
+ swap_in_source = gr.Checkbox(
+ False,
+ label="Swap in source image",
+ visible=is_img2img,
)
+ swap_in_generated = gr.Checkbox(
+ True,
+ label="Swap in generated image",
+ visible=is_img2img,
+ )
+ with gr.Tab("Upscale"):
restore_first = gr.Checkbox(
True,
label="1. Restore Face -> 2. Upscale (-Uncheck- if you want vice versa)",
@@ -95,23 +108,13 @@ class FaceSwapScript(scripts.Script):
choices=[upscaler.name for upscaler in shared.sd_upscalers],
label="Upscaler",
)
+ gr.Markdown("
")
with gr.Row():
upscaler_scale = gr.Slider(1, 8, 1, step=0.1, label="Scale by")
upscaler_visibility = gr.Slider(
0, 1, 1, step=0.1, label="Upscaler Visibility (if scale = 1)"
)
- gr.Markdown("---")
- swap_in_source = gr.Checkbox(
- False,
- label="Swap in source image",
- visible=is_img2img,
- )
- swap_in_generated = gr.Checkbox(
- True,
- label="Swap in generated image",
- visible=is_img2img,
- )
-
+ with gr.Tab("Settings"):
models = get_models()
with gr.Row():
if len(models) == 0:
@@ -132,7 +135,6 @@ class FaceSwapScript(scripts.Script):
label="Console Log Level",
type="index",
)
- gr.Markdown("---")
return [
img,
diff --git a/scripts/version.py b/scripts/version.py
index 42f3df6..d82c0dd 100644
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -1,5 +1,5 @@
app_title = "ReActor"
-version_flag = "v0.4.1-b1"
+version_flag = "v0.4.1-b2"
from scripts.logger import logger, get_Run, set_Run