Ashrafb commited on
Commit
3a16a22
·
verified ·
1 Parent(s): 10a3d69

Update vtoonify_model.py

Browse files
Files changed (1) hide show
  1. vtoonify_model.py +4 -4
vtoonify_model.py CHANGED
@@ -142,14 +142,14 @@ class Model():
142
  return frame, instyle, message
143
 
144
  #@torch.inference_mode()
145
- def detect_and_align_image(self, frame_rgb: np.ndarray, top: int, bottom: int, left: int, right: int) -> tuple[np.ndarray, torch.Tensor, str]:
146
- if frame_rgb is None:
147
  return np.zeros((256, 256, 3), np.uint8), None, 'Error: fail to load the image.'
148
 
149
  # Convert RGB to BGR
150
- frame_bgr = cv2.cvtColor(frame_rgb, cv2.COLOR_RGB2BGR)
151
 
152
- return self.detect_and_align(frame_bgr, top, bottom, left, right)
153
 
154
  def detect_and_align_video(self, video: str, top: int, bottom: int, left: int, right: int
155
  ) -> tuple[np.ndarray, torch.Tensor, str]:
 
142
  return frame, instyle, message
143
 
144
  #@torch.inference_mode()
145
+ def detect_and_align_image(self, frame_rgb: np.ndarray, top: int, bottom: int, left: int, right: int) -> tuple[np.ndarray, torch.Tensor, str]:
146
+ if frame_rgb is None:
147
  return np.zeros((256, 256, 3), np.uint8), None, 'Error: fail to load the image.'
148
 
149
  # Convert RGB to BGR
150
+ frame_bgr = cv2.cvtColor(frame_rgb, cv2.COLOR_RGB2BGR)
151
 
152
+ return self.detect_and_align(frame_bgr, top, bottom, left, right)
153
 
154
  def detect_and_align_video(self, video: str, top: int, bottom: int, left: int, right: int
155
  ) -> tuple[np.ndarray, torch.Tensor, str]: