Spaces:
Running
on
T4
Running
on
T4
PKUWilliamYang
commited on
Commit
•
f343e83
1
Parent(s):
e541a90
Update vtoonify_model.py
Browse files- vtoonify_model.py +2 -1
vtoonify_model.py
CHANGED
@@ -202,7 +202,7 @@ class Model():
|
|
202 |
return 'input.mp4', instyle, 'Successfully rescale the video to (%d, %d)'%(bottom-top, right-left)
|
203 |
|
204 |
def image_toonify(self, aligned_face: np.ndarray, instyle: torch.Tensor, exstyle: torch.Tensor, style_degree: float, style_type: str) -> tuple[np.ndarray, str]:
|
205 |
-
print(style_type + ' ' + self.style_name)
|
206 |
if instyle is None or aligned_face is None:
|
207 |
return np.zeros((256,256,3), np.uint8), 'Opps, something wrong with the input. Please go to Step 2 and Rescale Image/First Frame again.'
|
208 |
if self.style_name != style_type:
|
@@ -226,6 +226,7 @@ class Model():
|
|
226 |
return ((y_tilde[0].cpu().numpy().transpose(1, 2, 0) + 1.0) * 127.5).astype(np.uint8), 'Successfully toonify the image with style of %s'%(self.style_name)
|
227 |
|
228 |
def video_tooniy(self, aligned_video: str, instyle: torch.Tensor, exstyle: torch.Tensor, style_degree: float, style_type: str) -> tuple[str, str]:
|
|
|
229 |
if aligned_video is None:
|
230 |
return 'default.mp4', 'Opps, something wrong with the input. Please go to Step 2 and Rescale Video again.'
|
231 |
video_cap = cv2.VideoCapture(aligned_video)
|
|
|
202 |
return 'input.mp4', instyle, 'Successfully rescale the video to (%d, %d)'%(bottom-top, right-left)
|
203 |
|
204 |
def image_toonify(self, aligned_face: np.ndarray, instyle: torch.Tensor, exstyle: torch.Tensor, style_degree: float, style_type: str) -> tuple[np.ndarray, str]:
|
205 |
+
#print(style_type + ' ' + self.style_name)
|
206 |
if instyle is None or aligned_face is None:
|
207 |
return np.zeros((256,256,3), np.uint8), 'Opps, something wrong with the input. Please go to Step 2 and Rescale Image/First Frame again.'
|
208 |
if self.style_name != style_type:
|
|
|
226 |
return ((y_tilde[0].cpu().numpy().transpose(1, 2, 0) + 1.0) * 127.5).astype(np.uint8), 'Successfully toonify the image with style of %s'%(self.style_name)
|
227 |
|
228 |
def video_tooniy(self, aligned_video: str, instyle: torch.Tensor, exstyle: torch.Tensor, style_degree: float, style_type: str) -> tuple[str, str]:
|
229 |
+
#print(style_type + ' ' + self.style_name)
|
230 |
if aligned_video is None:
|
231 |
return 'default.mp4', 'Opps, something wrong with the input. Please go to Step 2 and Rescale Video again.'
|
232 |
video_cap = cv2.VideoCapture(aligned_video)
|