FIX: Upscale Issue #68

+VersionUP (beta1)
Thanks @NetCrafter99 for spotting
This commit is contained in:
Gourieff 2023-08-29 17:48:07 +07:00
parent 20cb6ee238
commit f5c09b53fd
4 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<img src="example/ReActor_logo_red.png" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/version-0.4.0-brightgreen?style=for-the-badge&labelColor=darkgreen)<hr>
![Version](https://img.shields.io/badge/version-0.4.1_beta1-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)
![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)

View File

@ -2,7 +2,7 @@
<img src="example/ReActor_logo_red.png" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/версия-0.4.0-brightgreen?style=for-the-badge&labelColor=darkgreen)<hr>
![Version](https://img.shields.io/badge/версия-0.4.1_beta1-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)
![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)

View File

@ -262,6 +262,8 @@ def swap_face(
source_face_idx = 0
swapped = 0
for face_num in faces_index:
if len(source_faces_index) > 1 and source_face_idx > 0:
source_face, wrong_gender = get_face_single(source_img, face_index=source_faces_index[source_face_idx], gender_source=gender_source)
@ -271,6 +273,7 @@ def swap_face(
target_face, wrong_gender = get_face_single(target_img, face_index=face_num, gender_target=gender_target)
if target_face is not None and wrong_gender == 0:
result = face_swapper.get(result, target_face, source_face)
swapped += 1
elif wrong_gender == 1:
wrong_gender = 0
if source_face_idx == len(source_faces_index):
@ -291,7 +294,7 @@ def swap_face(
logger.info(f"No source face found for face number {source_face_idx}.")
result_image = Image.fromarray(cv2.cvtColor(result, cv2.COLOR_BGR2RGB))
if upscale_options is not None and target_face is not None:
if upscale_options is not None and swapped > 0:
result_image = upscale_image(result_image, upscale_options)
else:

View File

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