- refactored swapper.py to optimized code logic

- refactored "get_face" and "get_all_faces" to "get_face_single" and "get_face_many" respectively
- moved all global booleans to top of file
This commit is contained in:
chris
2023-06-01 15:09:12 -04:00
parent b155a2cb36
commit d17a440cd6
4 changed files with 39 additions and 32 deletions

4
run.py
View File

@@ -22,7 +22,7 @@ from PIL import Image, ImageTk
import core.globals
from core.swapper import process_video, process_img
from core.utils import is_img, detect_fps, set_fps, create_video, add_audio, extract_frames, rreplace
from core.analyser import get_face
from core.analyser import get_face_single
if 'ROCMExecutionProvider' in core.globals.providers:
del torch
@@ -188,7 +188,7 @@ def start():
global pool
pool = mp.Pool(args['cores_count'])
target_path = args['target_path']
test_face = get_face(cv2.imread(args['source_img']))
test_face = get_face_single(cv2.imread(args['source_img']))
if not test_face:
print("\n[WARNING] No face detected in source image. Please try with another one.\n")
return