Skip to content

Commit

Permalink
batch singe images
Browse files Browse the repository at this point in the history
  • Loading branch information
kex0 committed Jun 3, 2023
2 parents 1072b86 + d30265b commit bdb501b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion roop/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def start():
quit()
process_img(args['source_img'], target_path, os.path.splitext(args['output_file'])[0] + f"_{i+1}.png")
status("swap successful!")
return
continue
seconds, probabilities = predict_video_frames(video_path=args['target_path'], frame_interval=100)
if any(probability > 0.85 for probability in probabilities):
quit()
Expand Down
3 changes: 3 additions & 0 deletions roop/swapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def process_video(source_img, frame_paths):
def process_img(source_img, target_path, output_file):
frame = cv2.imread(target_path)
face = get_face_single(frame)
if not face:
print(f"No face found in {target_path}")
return
source_face = get_face_single(cv2.imread(source_img))
result = get_face_swapper().get(frame, face, source_face, paste_back=True)
cv2.imwrite(output_file, result)
Expand Down

0 comments on commit bdb501b

Please sign in to comment.