Skip to content

Commit

Permalink
Update processor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
s0md3v authored May 31, 2023
1 parent c0f486e commit ab2fc1c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cv2
import insightface
import core.globals
from core.config import get_face

FACE_SWAPPER = None
Expand All @@ -11,7 +12,7 @@ def get_face_swapper():
global FACE_SWAPPER
if FACE_SWAPPER is None:
model_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../inswapper_128.onnx')
FACE_SWAPPER = insightface.model_zoo.get_model(model_path)
FACE_SWAPPER = insightface.model_zoo.get_model(model_path, providers=core.globals.providers)
return FACE_SWAPPER


Expand All @@ -38,4 +39,4 @@ def process_img(source_img, target_path, output_file):
source_face = get_face(cv2.imread(source_img))
result = get_face_swapper().get(frame, face, source_face, paste_back=True)
cv2.imwrite(output_file, result)
print("\n\nImage saved as:", output_file, "\n\n")
print("\n\nImage saved as:", output_file, "\n\n")

0 comments on commit ab2fc1c

Please sign in to comment.