root
commited on
Commit
·
71aed9c
1
Parent(s):
fd0683b
fixing facefusion
Browse files- handler.py +4 -4
handler.py
CHANGED
|
@@ -372,11 +372,11 @@ class EndpointHandler():
|
|
| 372 |
torch.cuda.empty_cache()
|
| 373 |
|
| 374 |
# Perform face swapping
|
| 375 |
-
self.print_directory_contents()
|
| 376 |
swapped_face_video_path = os.path.join(save_dir, "swapped_face_output.mp4")
|
| 377 |
|
| 378 |
# Subprocess call to facefusion for face swapping
|
| 379 |
-
self.print_directory_contents()
|
| 380 |
facefusion_script_path = os.path.join(base_dir, 'facefusion', 'core.py')
|
| 381 |
swap_command = f'python3 {facefusion_script_path} --source {cropped_face_path} --target {animation_path} --output {swapped_face_video_path}'
|
| 382 |
swap_result = subprocess.run(swap_command, shell=True, capture_output=True, text=True)
|
|
@@ -384,7 +384,7 @@ class EndpointHandler():
|
|
| 384 |
raise RuntimeError(f"Error running face swap: {swap_result.stderr}")
|
| 385 |
|
| 386 |
# Slow down the produced video by 4x
|
| 387 |
-
self.print_directory_contents(temp_dir)
|
| 388 |
# slowed_down_animation_path = os.path.join(save_dir, "slowed_down_animation_output.mp4")
|
| 389 |
# self.slow_down_video(animation_path, slowed_down_animation_path, factor=4)
|
| 390 |
|
|
@@ -393,7 +393,7 @@ class EndpointHandler():
|
|
| 393 |
|
| 394 |
|
| 395 |
#remove background
|
| 396 |
-
self.print_directory_contents()
|
| 397 |
removed_background_output_path = os.path.join(save_dir, "removed_background_result.mp4")
|
| 398 |
remove_background_command = f'python3 ./rembg_video.py {swapped_face_video_path} {removed_background_output_path}'
|
| 399 |
print("Command is " + remove_background_command)
|
|
|
|
| 372 |
torch.cuda.empty_cache()
|
| 373 |
|
| 374 |
# Perform face swapping
|
| 375 |
+
# self.print_directory_contents()
|
| 376 |
swapped_face_video_path = os.path.join(save_dir, "swapped_face_output.mp4")
|
| 377 |
|
| 378 |
# Subprocess call to facefusion for face swapping
|
| 379 |
+
# self.print_directory_contents()
|
| 380 |
facefusion_script_path = os.path.join(base_dir, 'facefusion', 'core.py')
|
| 381 |
swap_command = f'python3 {facefusion_script_path} --source {cropped_face_path} --target {animation_path} --output {swapped_face_video_path}'
|
| 382 |
swap_result = subprocess.run(swap_command, shell=True, capture_output=True, text=True)
|
|
|
|
| 384 |
raise RuntimeError(f"Error running face swap: {swap_result.stderr}")
|
| 385 |
|
| 386 |
# Slow down the produced video by 4x
|
| 387 |
+
# self.print_directory_contents(temp_dir)
|
| 388 |
# slowed_down_animation_path = os.path.join(save_dir, "slowed_down_animation_output.mp4")
|
| 389 |
# self.slow_down_video(animation_path, slowed_down_animation_path, factor=4)
|
| 390 |
|
|
|
|
| 393 |
|
| 394 |
|
| 395 |
#remove background
|
| 396 |
+
# self.print_directory_contents()
|
| 397 |
removed_background_output_path = os.path.join(save_dir, "removed_background_result.mp4")
|
| 398 |
remove_background_command = f'python3 ./rembg_video.py {swapped_face_video_path} {removed_background_output_path}'
|
| 399 |
print("Command is " + remove_background_command)
|