Spaces:
Runtime error
Runtime error
Commit
·
1874694
1
Parent(s):
cd3efb9
queue test
Browse files- vtoonify_model.py +3 -2
vtoonify_model.py
CHANGED
|
@@ -227,7 +227,8 @@ class Model():
|
|
| 227 |
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)
|
| 228 |
|
| 229 |
def video_tooniy(self, aligned_video: str, instyle: torch.Tensor, exstyle: torch.Tensor, style_degree: float, style_type: str) -> tuple[str, str]:
|
| 230 |
-
|
|
|
|
| 231 |
if aligned_video is None:
|
| 232 |
return 'default.mp4', 'Opps, something wrong with the input. Please go to Step 2 and Rescale Video again. 1'
|
| 233 |
video_cap = cv2.VideoCapture(aligned_video)
|
|
@@ -237,7 +238,7 @@ class Model():
|
|
| 237 |
if self.style_name != style_type:
|
| 238 |
exstyle, _ = self.load_model(style_type)
|
| 239 |
if exstyle is None:
|
| 240 |
-
|
| 241 |
num = min(self.video_limit_gpu, int(video_cap.get(7)))
|
| 242 |
if self.device == 'cpu':
|
| 243 |
num = min(self.video_limit_cpu, num)
|
|
|
|
| 227 |
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)
|
| 228 |
|
| 229 |
def video_tooniy(self, aligned_video: str, instyle: torch.Tensor, exstyle: torch.Tensor, style_degree: float, style_type: str) -> tuple[str, str]:
|
| 230 |
+
print(style_type + ' ' + self.style_name)
|
| 231 |
+
exstyle, _ = self.load_model(style_type)
|
| 232 |
if aligned_video is None:
|
| 233 |
return 'default.mp4', 'Opps, something wrong with the input. Please go to Step 2 and Rescale Video again. 1'
|
| 234 |
video_cap = cv2.VideoCapture(aligned_video)
|
|
|
|
| 238 |
if self.style_name != style_type:
|
| 239 |
exstyle, _ = self.load_model(style_type)
|
| 240 |
if exstyle is None:
|
| 241 |
+
return 'default.mp4', 'Opps, something wrong with the style type. Please go to Step 1 and load model again. 3'
|
| 242 |
num = min(self.video_limit_gpu, int(video_cap.get(7)))
|
| 243 |
if self.device == 'cpu':
|
| 244 |
num = min(self.video_limit_cpu, num)
|