FIX: API Issue #102

Thanks @Dutch77 for spotting
This commit is contained in:
Gourieff 2023-09-20 00:30:43 +07:00
parent 96c124491e
commit 53f4b3d677
2 changed files with 5 additions and 4 deletions

View File

@ -87,12 +87,11 @@ def reactor_api(_: gr.Blocks, app: FastAPI):
if result_file_path == "": if result_file_path == "":
result_file_path = default_file_path() result_file_path = default_file_path()
try: 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: except Exception as e:
logger.error("Error while saving result: %s",e) logger.error("Error while saving result: %s",e)
finally: return {"image": api.encode_pil_to_base64(result[0])}
logger.info("Result has been saved to: %s", result_file_path)
return {"image": api.encode_pil_to_base64(result)}
@app.get("/reactor/models") @app.get("/reactor/models")
async def reactor_models(): async def reactor_models():

View File

@ -246,6 +246,8 @@ class FaceSwapScript(scripts.Script):
self.source_faces_index = [0] self.source_faces_index = [0]
if len(self.faces_index) == 0: if len(self.faces_index) == 0:
self.faces_index = [0] self.faces_index = [0]
if self.save_original is None:
self.save_original = False
if self.source is not None: if self.source is not None:
apply_logging_patch(console_logging_level) apply_logging_patch(console_logging_level)