UPDATE: XYZ Improved - "Face Model" axis is ready

+VersionUP (0.7.0 beta2)
This commit is contained in:
Art Gourieff 2024-03-02 13:24:20 +07:00
parent 565704285b
commit 6c3bf1c6c4
4 changed files with 48 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_EN.png?raw=true" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/version-0.7.0_beta1-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/version-0.7.0_beta2-green?style=for-the-badge&labelColor=darkgreen)
<a href="https://boosty.to/artgourieff" target="_blank">
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Support Me on Boosty"/>
@ -43,14 +43,29 @@
<details>
<summary><a>Click to expand</a></summary>
### 0.7.0 <sub><sup>BETA2
- X/Y/Z is improved! One more parameter is ready: you can now select several face models to create a variation of swaps to choose the best one!
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-05.jpg?raw=true" alt="0.7.0-whatsnew-05" width="100%"/>
To use "Face Model" axis - you should enable ReActor and choose any face model as the Source:<br>
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-07.jpg?raw=true" alt="0.7.0-whatsnew-07" width="50%"/><img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-06.jpg?raw=true" alt="0.7.0-whatsnew-06" width="50%"/>
Full size demo image: [xyz_demo_2.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo_2.png)
### 0.7.0 <sub><sup>BETA1
- X/Y/Z Script support (up to 3 axis: CodeFormer Weight, Restorer Visibility, Face Mask Correction)
- X/Y/Z Script support (up to 3 axes: CodeFormer Weight, Restorer Visibility, Face Mask Correction)
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-03.jpg?raw=true" alt="0.7.0-whatsnew-03" width="100%"/>
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-04.jpg?raw=true" alt="0.7.0-whatsnew-04" width="100%"/>
Full size demo image: [xyz_demo.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo.png)
__Don't forget to enable ReActor and set any source (to prevent "no source" error)__
### 0.7.0 <sub><sup>ALPHA1
- You can now blend faces to build blended face models ("Tools->Face Models->Blend") - due to popular demand

View File

@ -2,7 +2,7 @@
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_RU.png?raw=true" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/версия-0.7.0_beta1-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/версия-0.7.0_beta2-green?style=for-the-badge&labelColor=darkgreen)
<a href="https://boosty.to/artgourieff" target="_blank">
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/>
@ -42,13 +42,24 @@
<details>
<summary><a>Нажмите, чтобы посмотреть</a></summary>
### 0.7.0 <sub><sup>BETA2
- X/Y/Z опция улучшена! Добавлен ещё один параметр: теперь вы можете выбрать несколько моделей лиц для создания вариации замененных лиц, чтобы выбрать наилучшие!
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-05.jpg?raw=true" alt="0.7.0-whatsnew-05" width="100%"/>
Чтобы использовать ось "Face Model" - активируйте РеАктор и выбирите любую модель лица в качестве источника:<br>
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-07.jpg?raw=true" alt="0.7.0-whatsnew-07" width="50%"/><img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-06.jpg?raw=true" alt="0.7.0-whatsnew-06" width="50%"/>
Полноразмерное демо-изображение: [xyz_demo_2.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo_2.png)
### 0.7.0 <sub><sup>BETA1
- Поддержка X/Y/Z скрипта (до 3-х параметров: CodeFormer Weight, Restorer Visibility, Face Mask Correction)
<img src="https://github.com/Gourieff/Assets/blob/main/sd-webui-reactor/0.7.0-whatsnew-03.jpg?raw=true" alt="0.7.0-whatsnew-03" width="100%"/>
Full size demo image: [xyz_demo.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo.png)
Полноразмерное демо-изображение: [xyz_demo.png](https://raw.githubusercontent.com/Gourieff/Assets/main/sd-webui-reactor/xyz_demo.png)
### 0.7.0 <sub><sup>ALPHA1

View File

@ -256,6 +256,7 @@ class FaceSwapScript(scripts.Script):
self.face_restorer_visibility = shared.opts.data['restorer_visibility'] if 'restorer_visibility' in shared.opts.data.keys() else 1
self.codeformer_weight = shared.opts.data['codeformer_weight'] if 'codeformer_weight' in shared.opts.data.keys() else 0.5
self.mask_face = shared.opts.data['mask_face'] if 'mask_face' in shared.opts.data.keys() else False
self.face_model = shared.opts.data['face_model'] if 'face_model' in shared.opts.data.keys() else "None"
logger.debug("*** Set Device")
set_Device(self.device)

View File

@ -5,6 +5,11 @@ Thanks @ledahu for contributing
from modules import scripts
from modules.shared import opts
from scripts.reactor_helpers import (
get_model_names,
get_facemodels
)
# xyz_grid = [x for x in scripts.scripts_data if x.script_class.__module__ == "xyz_grid.py"][0].module
def find_module(module_names):
@ -29,6 +34,9 @@ def bool_(string):
def choices_bool():
return ["False", "True"]
def choices_face_models():
return get_model_names(get_facemodels)
def float_applier(value_name:str, min_range:float = 0, max_range:float = 1):
"""
Returns a function that applies the given value to the given value_name in opts.data.
@ -46,17 +54,24 @@ def float_applier(value_name:str, min_range:float = 0, max_range:float = 1):
return apply_float
def bool_applier(value_name:str):
def apply_bool__(p, x, xs):
def apply_bool(p, x, xs):
x_normed = bool_(x)
opts.data[value_name] = x_normed
# print(f'normed = {x_normed}')
return apply_bool__
return apply_bool
def str_applier(value_name:str):
def apply_str(p, x, xs):
opts.data[value_name] = x
return apply_str
def add_axis_options(xyz_grid):
extra_axis_options = [
xyz_grid.AxisOption("[ReActor] CodeFormer Weight", float, float_applier("codeformer_weight", 0, 1)),
xyz_grid.AxisOption("[ReActor] Restorer Visibility", float, float_applier("restorer_visibility", 0, 1)),
xyz_grid.AxisOption("[ReActor] Face Mask Correction", str, bool_applier("mask_face"), choices=choices_bool),
xyz_grid.AxisOption("[ReActor] Face Models", str, str_applier("face_model"), choices=choices_face_models),
]
set_a = {opt.label for opt in xyz_grid.axis_options}
set_b = {opt.label for opt in extra_axis_options}