parent
8fafab9777
commit
565704285b
10
README.md
10
README.md
@ -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"/>
|
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_EN.png?raw=true" alt="logo" width="180px"/>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href="https://boosty.to/artgourieff" target="_blank">
|
<a href="https://boosty.to/artgourieff" target="_blank">
|
||||||
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Support Me on Boosty"/>
|
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Support Me on Boosty"/>
|
||||||
@ -43,6 +43,14 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary><a>Click to expand</a></summary>
|
<summary><a>Click to expand</a></summary>
|
||||||
|
|
||||||
|
### 0.7.0 <sub><sup>BETA1
|
||||||
|
|
||||||
|
- X/Y/Z Script support (up to 3 axis: 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)
|
||||||
|
|
||||||
### 0.7.0 <sub><sup>ALPHA1
|
### 0.7.0 <sub><sup>ALPHA1
|
||||||
|
|
||||||
- You can now blend faces to build blended face models ("Tools->Face Models->Blend") - due to popular demand
|
- You can now blend faces to build blended face models ("Tools->Face Models->Blend") - due to popular demand
|
||||||
|
|||||||
10
README_RU.md
10
README_RU.md
@ -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"/>
|
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_RU.png?raw=true" alt="logo" width="180px"/>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href="https://boosty.to/artgourieff" target="_blank">
|
<a href="https://boosty.to/artgourieff" target="_blank">
|
||||||
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/>
|
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/>
|
||||||
@ -42,6 +42,14 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary><a>Нажмите, чтобы посмотреть</a></summary>
|
<summary><a>Нажмите, чтобы посмотреть</a></summary>
|
||||||
|
|
||||||
|
### 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)
|
||||||
|
|
||||||
### 0.7.0 <sub><sup>ALPHA1
|
### 0.7.0 <sub><sup>ALPHA1
|
||||||
|
|
||||||
- По многочисленным просьбам появилась возможность строить смешанные модели лиц ("Tools->Face Models->Blend")
|
- По многочисленным просьбам появилась возможность строить смешанные модели лиц ("Tools->Face Models->Blend")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
'''
|
'''
|
||||||
Thanks SpenserCai for the original version of the roop api script
|
Thanks SpenserCai for the original version of the roop api script
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
--- ReActor External API v1.0.5 ---
|
--- ReActor External API v1.0.6 ---
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
'''
|
'''
|
||||||
import os, glob
|
import os, glob
|
||||||
@ -17,6 +17,15 @@ import gradio as gr
|
|||||||
from scripts.reactor_swapper import EnhancementOptions, swap_face, DetectionOptions
|
from scripts.reactor_swapper import EnhancementOptions, swap_face, DetectionOptions
|
||||||
from scripts.reactor_logger import logger
|
from scripts.reactor_logger import logger
|
||||||
|
|
||||||
|
# XYZ init:
|
||||||
|
from scripts.reactor_xyz import run
|
||||||
|
try:
|
||||||
|
import modules.script_callbacks as script_callbacks
|
||||||
|
script_callbacks.on_before_ui(run)
|
||||||
|
# script_callbacks.on_app_started(reactor_api)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def default_file_path():
|
def default_file_path():
|
||||||
time = datetime.now()
|
time = datetime.now()
|
||||||
|
|||||||
@ -251,6 +251,11 @@ class FaceSwapScript(scripts.Script):
|
|||||||
self.random_image = False
|
self.random_image = False
|
||||||
if self.upscale_force is None:
|
if self.upscale_force is None:
|
||||||
self.upscale_force = False
|
self.upscale_force = False
|
||||||
|
|
||||||
|
if shared.state.job_count > 0:
|
||||||
|
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
|
||||||
|
|
||||||
logger.debug("*** Set Device")
|
logger.debug("*** Set Device")
|
||||||
set_Device(self.device)
|
set_Device(self.device)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
app_title = "ReActor"
|
app_title = "ReActor"
|
||||||
version_flag = "v0.7.0-a2"
|
version_flag = "v0.7.0-b1"
|
||||||
|
|
||||||
from scripts.reactor_logger import logger, get_Run, set_Run
|
from scripts.reactor_logger import logger, get_Run, set_Run
|
||||||
from scripts.reactor_globals import DEVICE
|
from scripts.reactor_globals import DEVICE
|
||||||
|
|||||||
71
scripts/reactor_xyz.py
Normal file
71
scripts/reactor_xyz.py
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
'''
|
||||||
|
Thanks @ledahu for contributing
|
||||||
|
'''
|
||||||
|
|
||||||
|
from modules import scripts
|
||||||
|
from modules.shared import opts
|
||||||
|
|
||||||
|
# xyz_grid = [x for x in scripts.scripts_data if x.script_class.__module__ == "xyz_grid.py"][0].module
|
||||||
|
|
||||||
|
def find_module(module_names):
|
||||||
|
if isinstance(module_names, str):
|
||||||
|
module_names = [s.strip() for s in module_names.split(",")]
|
||||||
|
for data in scripts.scripts_data:
|
||||||
|
if data.script_class.__module__ in module_names and hasattr(data, "module"):
|
||||||
|
return data.module
|
||||||
|
return None
|
||||||
|
|
||||||
|
def bool_(string):
|
||||||
|
string = str(string)
|
||||||
|
if string in ["None", ""]:
|
||||||
|
return None
|
||||||
|
elif string.lower() in ["true", "1"]:
|
||||||
|
return True
|
||||||
|
elif string.lower() in ["false", "0"]:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Could not convert string to boolean: {string}")
|
||||||
|
|
||||||
|
def choices_bool():
|
||||||
|
return ["False", "True"]
|
||||||
|
|
||||||
|
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.
|
||||||
|
"""
|
||||||
|
def validate(value_name:str, value:str):
|
||||||
|
value = float(value)
|
||||||
|
# validate value
|
||||||
|
if not min_range == 0:
|
||||||
|
assert value >= min_range, f"Value {value} for {value_name} must be greater than or equal to {min_range}"
|
||||||
|
if not max_range == 1:
|
||||||
|
assert value <= max_range, f"Value {value} for {value_name} must be less than or equal to {max_range}"
|
||||||
|
def apply_float(p, x, xs):
|
||||||
|
validate(value_name, x)
|
||||||
|
opts.data[value_name] = float(x)
|
||||||
|
return apply_float
|
||||||
|
|
||||||
|
def bool_applier(value_name:str):
|
||||||
|
def apply_bool__(p, x, xs):
|
||||||
|
x_normed = bool_(x)
|
||||||
|
opts.data[value_name] = x_normed
|
||||||
|
# print(f'normed = {x_normed}')
|
||||||
|
return apply_bool__
|
||||||
|
|
||||||
|
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),
|
||||||
|
]
|
||||||
|
set_a = {opt.label for opt in xyz_grid.axis_options}
|
||||||
|
set_b = {opt.label for opt in extra_axis_options}
|
||||||
|
if set_a.intersection(set_b):
|
||||||
|
return
|
||||||
|
|
||||||
|
xyz_grid.axis_options.extend(extra_axis_options)
|
||||||
|
|
||||||
|
def run():
|
||||||
|
xyz_grid = find_module("xyz_grid.py, xy_grid.py")
|
||||||
|
if xyz_grid:
|
||||||
|
add_axis_options(xyz_grid)
|
||||||
Loading…
x
Reference in New Issue
Block a user