UPDATE: UI rework

+ Inpaint info update
+ VersionUP (beta2)
This commit is contained in:
Gourieff 2023-08-31 15:09:11 +07:00
parent b2ace90b72
commit 08aba2cdb6
4 changed files with 61 additions and 59 deletions

View File

@ -2,7 +2,7 @@
<img src="example/ReActor_logo_red.png" alt="logo" width="180px"/> <img src="example/ReActor_logo_red.png" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/version-0.4.1_beta1-green?style=for-the-badge&labelColor=darkgreen)<hr> ![Version](https://img.shields.io/badge/version-0.4.1_beta2-green?style=for-the-badge&labelColor=darkgreen)<hr>
[![Commit activity](https://img.shields.io/github/commit-activity/t/Gourieff/sd-webui-reactor/main?cacheSeconds=0)](https://github.com/Gourieff/sd-webui-reactor/commits/main) [![Commit activity](https://img.shields.io/github/commit-activity/t/Gourieff/sd-webui-reactor/main?cacheSeconds=0)](https://github.com/Gourieff/sd-webui-reactor/commits/main)
![Last commit](https://img.shields.io/github/last-commit/Gourieff/sd-webui-reactor/main?cacheSeconds=0) ![Last commit](https://img.shields.io/github/last-commit/Gourieff/sd-webui-reactor/main?cacheSeconds=0)
[![Opened issues](https://img.shields.io/github/issues/Gourieff/sd-webui-reactor?color=red)](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0) [![Opened issues](https://img.shields.io/github/issues/Gourieff/sd-webui-reactor?color=red)](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. 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.<br>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.<br>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 ## API

View File

@ -2,7 +2,7 @@
<img src="example/ReActor_logo_red.png" alt="logo" width="180px"/> <img src="example/ReActor_logo_red.png" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/версия-0.4.1_beta1-green?style=for-the-badge&labelColor=darkgreen)<hr> ![Version](https://img.shields.io/badge/версия-0.4.1_beta2-green?style=for-the-badge&labelColor=darkgreen)<hr>
[![Commit activity](https://img.shields.io/github/commit-activity/t/Gourieff/sd-webui-reactor/main?cacheSeconds=0)](https://github.com/Gourieff/sd-webui-reactor/commits/main) [![Commit activity](https://img.shields.io/github/commit-activity/t/Gourieff/sd-webui-reactor/main?cacheSeconds=0)](https://github.com/Gourieff/sd-webui-reactor/commits/main)
![Last commit](https://img.shields.io/github/last-commit/Gourieff/sd-webui-reactor/main?cacheSeconds=0) ![Last commit](https://img.shields.io/github/last-commit/Gourieff/sd-webui-reactor/main?cacheSeconds=0)
[![Opened issues](https://img.shields.io/github/issues/Gourieff/sd-webui-reactor?color=red)](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0) [![Opened issues](https://img.shields.io/github/issues/Gourieff/sd-webui-reactor?color=red)](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0)
@ -118,7 +118,7 @@
Используйте эту вкладку, чтобы заменить лицо на уже готовом изображении (флажок "Swap in source image") или на сгенерированном на основе готового (флажок "Swap in generated image"). Используйте эту вкладку, чтобы заменить лицо на уже готовом изображении (флажок "Swap in source image") или на сгенерированном на основе готового (флажок "Swap in generated image").
Inpainting также работает, но замена лица происходит только в области маски.<br>Пожалуйста, используйте с опцией "Only masked" для "Inpaint area", если вы применяете "Upscaler". Inpainting также работает, но замена лица происходит только в области маски.<br>Пожалуйста, используйте с опцией "Only masked" для "Inpaint area", если вы применяете "Upscaler". Иначе, используйте функцию увеличения (апскейла) через вкладку "Extras" или через опциональный загрузчик "Script" (внизу экрана), применив "SD upscale" или "Ultimate SD upscale".
## API ## API

View File

@ -44,48 +44,61 @@ class FaceSwapScript(scripts.Script):
def ui(self, is_img2img): def ui(self, is_img2img):
with gr.Accordion(f"{app_title}", open=False): with gr.Accordion(f"{app_title}", open=False):
with gr.Column(): with gr.Tab("Input"):
img = gr.inputs.Image(type="pil") with gr.Column():
enable = gr.Checkbox(False, label="Enable", info=f"The Fast and Simple \"roop-based\" FaceSwap Extension - {version_flag}") img = gr.inputs.Image(type="pil")
gr.Markdown("---") enable = gr.Checkbox(False, label="Enable", info=f"The Fast and Simple FaceSwap Extension - {version_flag}")
gr.Markdown("Source Image (above):") gr.Markdown("<br>")
with gr.Row(): gr.Markdown("Source Image (above):")
source_faces_index = gr.Textbox( with gr.Row():
value="0", source_faces_index = gr.Textbox(
placeholder="Which face(s) to use as Source (comma separated)", value="0",
label="Comma separated face number(s); Example: 0,2,1", 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"], gender_source = gr.Radio(
value="No", ["No", "Female Only", "Male Only"],
label="Gender Detection (Source)", value="No",
type="index", label="Gender Detection (Source)",
) type="index",
gr.Markdown("---") )
gr.Markdown("Target Image (result):") gr.Markdown("<br>")
with gr.Row(): gr.Markdown("Target Image (result):")
faces_index = gr.Textbox( with gr.Row():
value="0", faces_index = gr.Textbox(
placeholder="Which face(s) to Swap into Target (comma separated)", value="0",
label="Comma separated face number(s); Example: 1,0,2", 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"], gender_target = gr.Radio(
value="No", ["No", "Female Only", "Male Only"],
label="Gender Detection (Target)", value="No",
type="index", label="Gender Detection (Target)",
) type="index",
gr.Markdown("---") )
with gr.Row(): gr.Markdown("<br>")
face_restorer_name = gr.Radio( with gr.Row():
label="Restore Face", face_restorer_name = gr.Radio(
choices=["None"] + [x.name() for x in shared.face_restorers], label="Restore Face",
value=shared.face_restorers[0].name(), choices=["None"] + [x.name() for x in shared.face_restorers],
type="value", value=shared.face_restorers[0].name(),
) type="value",
face_restorer_visibility = gr.Slider( )
0, 1, 1, step=0.1, label="Restore Face Visibility" face_restorer_visibility = gr.Slider(
0, 1, 1, step=0.1, label="Restore Face Visibility"
)
gr.Markdown("<br>")
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( restore_first = gr.Checkbox(
True, True,
label="1. Restore Face -> 2. Upscale (-Uncheck- if you want vice versa)", 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], choices=[upscaler.name for upscaler in shared.sd_upscalers],
label="Upscaler", label="Upscaler",
) )
gr.Markdown("<br>")
with gr.Row(): with gr.Row():
upscaler_scale = gr.Slider(1, 8, 1, step=0.1, label="Scale by") upscaler_scale = gr.Slider(1, 8, 1, step=0.1, label="Scale by")
upscaler_visibility = gr.Slider( upscaler_visibility = gr.Slider(
0, 1, 1, step=0.1, label="Upscaler Visibility (if scale = 1)" 0, 1, 1, step=0.1, label="Upscaler Visibility (if scale = 1)"
) )
gr.Markdown("---") with gr.Tab("Settings"):
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,
)
models = get_models() models = get_models()
with gr.Row(): with gr.Row():
if len(models) == 0: if len(models) == 0:
@ -132,7 +135,6 @@ class FaceSwapScript(scripts.Script):
label="Console Log Level", label="Console Log Level",
type="index", type="index",
) )
gr.Markdown("---")
return [ return [
img, img,

View File

@ -1,5 +1,5 @@
app_title = "ReActor" app_title = "ReActor"
version_flag = "v0.4.1-b1" version_flag = "v0.4.1-b2"
from scripts.logger import logger, get_Run, set_Run from scripts.logger import logger, get_Run, set_Run