root commited on
Commit
6c7fbb7
·
1 Parent(s): a7f2e6c

making it work with cropped faces better

Browse files
__pycache__/handler.cpython-310.pyc CHANGED
Binary files a/__pycache__/handler.cpython-310.pyc and b/__pycache__/handler.cpython-310.pyc differ
 
handler.py CHANGED
@@ -103,8 +103,8 @@ class EndpointHandler():
103
  return cropped_face
104
 
105
  def _swap_face(self, source_image, target_video_path):
106
- # Use a predefined face image instead of the provided source_image
107
- source_path = "/root/AnimateAnyone/good_face.jpeg" # Change this to your known good face image path
108
  output_path = "output.mp4"
109
 
110
  roop.globals.source_path = source_path
@@ -126,9 +126,7 @@ class EndpointHandler():
126
  if not frame_processor.pre_check():
127
  raise ValueError("Frame processor pre-check failed.")
128
 
129
- print(f"Starting face swap with source: {source_path} and target: {target_video_path}")
130
  start()
131
- print(f"Face swap completed. Output saved to: {output_path}")
132
 
133
  return os.path.join(os.getcwd(), output_path)
134
 
 
103
  return cropped_face
104
 
105
  def _swap_face(self, source_image, target_video_path):
106
+ source_path = "input.jpg"
107
+ source_image.save(source_path, format="JPEG", quality=95)
108
  output_path = "output.mp4"
109
 
110
  roop.globals.source_path = source_path
 
126
  if not frame_processor.pre_check():
127
  raise ValueError("Frame processor pre-check failed.")
128
 
 
129
  start()
 
130
 
131
  return os.path.join(os.getcwd(), output_path)
132
 
input.jpg CHANGED
output.mp4 CHANGED
Binary files a/output.mp4 and b/output.mp4 differ
 
output/gradio/animation_output.mp4 CHANGED
Binary files a/output/gradio/animation_output.mp4 and b/output/gradio/animation_output.mp4 differ