FIX: List index out of range when no face found

Face Model Error, Issue #214
This commit is contained in:
Gourieff 2023-11-26 00:21:50 +07:00
parent 70479479b3
commit d11a8a6941
4 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/version-0.5.1_beta3-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/version-0.5.1_beta4-green?style=for-the-badge&labelColor=darkgreen)
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

View File

@ -2,7 +2,7 @@
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/версия-0.5.1_beta3-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/версия-0.5.1_beta4-green?style=for-the-badge&labelColor=darkgreen)
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

View File

@ -533,10 +533,10 @@ def build_face_model(image: Image.Image, name: str):
apply_logging_patch(1)
image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
logger.status("Building Face Model...")
face_model = analyze_faces(image)[0]
if face_model is not None:
face_model = analyze_faces(image)
if face_model is not None and len(face_model) > 0:
face_model_path = os.path.join(FACE_MODELS_PATH, name + ".safetensors")
save_face_model(face_model,face_model_path)
save_face_model(face_model[0],face_model_path)
logger.status("--Done!--")
done_msg = f"Face model has been saved to '{face_model_path}'"
logger.status(done_msg)

View File

@ -1,5 +1,5 @@
app_title = "ReActor"
version_flag = "v0.5.1-b3"
version_flag = "v0.5.1-b4"
from scripts.reactor_logger import logger, get_Run, set_Run