From 53f4b3d677c4e4cc7e4247466126b4e19fdb7738 Mon Sep 17 00:00:00 2001 From: Gourieff <777@lovemet.ru> Date: Wed, 20 Sep 2023 00:30:43 +0700 Subject: [PATCH] FIX: API Issue #102 Thanks @Dutch77 for spotting --- scripts/reactor_api.py | 7 +++---- scripts/reactor_faceswap.py | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/reactor_api.py b/scripts/reactor_api.py index 1917075..4ed8101 100644 --- a/scripts/reactor_api.py +++ b/scripts/reactor_api.py @@ -87,12 +87,11 @@ def reactor_api(_: gr.Blocks, app: FastAPI): if result_file_path == "": result_file_path = default_file_path() try: - result.save(result_file_path, format='PNG') + result[0].save(result_file_path, format='PNG') + logger.info("Result has been saved to: %s", result_file_path) except Exception as e: logger.error("Error while saving result: %s",e) - finally: - logger.info("Result has been saved to: %s", result_file_path) - return {"image": api.encode_pil_to_base64(result)} + return {"image": api.encode_pil_to_base64(result[0])} @app.get("/reactor/models") async def reactor_models(): diff --git a/scripts/reactor_faceswap.py b/scripts/reactor_faceswap.py index eeeb31d..c5cad56 100644 --- a/scripts/reactor_faceswap.py +++ b/scripts/reactor_faceswap.py @@ -246,6 +246,8 @@ class FaceSwapScript(scripts.Script): self.source_faces_index = [0] if len(self.faces_index) == 0: self.faces_index = [0] + if self.save_original is None: + self.save_original = False if self.source is not None: apply_logging_patch(console_logging_level)