From f5c09b53fd5681c464dfa9ed05e239717bf3d65d Mon Sep 17 00:00:00 2001 From: Gourieff <777@lovemet.ru> Date: Tue, 29 Aug 2023 17:48:07 +0700 Subject: [PATCH] FIX: Upscale Issue #68 +VersionUP (beta1) Thanks @NetCrafter99 for spotting --- README.md | 2 +- README_RU.md | 2 +- scripts/swapper.py | 5 ++++- scripts/version.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bdeb70b..e3f7c60 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ logo - ![Version](https://img.shields.io/badge/version-0.4.0-brightgreen?style=for-the-badge&labelColor=darkgreen)
+ ![Version](https://img.shields.io/badge/version-0.4.1_beta1-green?style=for-the-badge&labelColor=darkgreen)
[![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) diff --git a/README_RU.md b/README_RU.md index 456242b..8aa634a 100644 --- a/README_RU.md +++ b/README_RU.md @@ -2,7 +2,7 @@ logo - ![Version](https://img.shields.io/badge/версия-0.4.0-brightgreen?style=for-the-badge&labelColor=darkgreen)
+ ![Version](https://img.shields.io/badge/версия-0.4.1_beta1-green?style=for-the-badge&labelColor=darkgreen)
[![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) diff --git a/scripts/swapper.py b/scripts/swapper.py index 19c134e..f7b57de 100644 --- a/scripts/swapper.py +++ b/scripts/swapper.py @@ -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: diff --git a/scripts/version.py b/scripts/version.py index bef7891..42f3df6 100644 --- a/scripts/version.py +++ b/scripts/version.py @@ -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