Spaces:
Runtime error
Runtime error
Commit
·
ff9cca3
1
Parent(s):
1d825ff
queue test
Browse files- vtoonify_model.py +5 -3
vtoonify_model.py
CHANGED
|
@@ -208,6 +208,7 @@ class Model():
|
|
| 208 |
if self.style_name != style_type:
|
| 209 |
exstyle, _ = self.load_model(style_type)
|
| 210 |
if exstyle is None:
|
|
|
|
| 211 |
return np.zeros((256,256,3), np.uint8), 'Opps, something wrong with the style type. Please go to Step 1 and load model again.'
|
| 212 |
with torch.no_grad():
|
| 213 |
if self.color_transfer:
|
|
@@ -228,15 +229,16 @@ class Model():
|
|
| 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)
|
| 233 |
if instyle is None or aligned_video is None or video_cap.get(7) == 0:
|
| 234 |
video_cap.release()
|
| 235 |
-
return 'default.mp4', 'Opps, something wrong with the input. Please go to Step 2 and Rescale Video again.'
|
| 236 |
if self.style_name != style_type:
|
| 237 |
exstyle, _ = self.load_model(style_type)
|
| 238 |
if exstyle is None:
|
| 239 |
-
|
|
|
|
| 240 |
num = min(self.video_limit_gpu, int(video_cap.get(7)))
|
| 241 |
if self.device == 'cpu':
|
| 242 |
num = min(self.video_limit_cpu, num)
|
|
|
|
| 208 |
if self.style_name != style_type:
|
| 209 |
exstyle, _ = self.load_model(style_type)
|
| 210 |
if exstyle is None:
|
| 211 |
+
exstyle, _ = self.load_model(style_type)
|
| 212 |
return np.zeros((256,256,3), np.uint8), 'Opps, something wrong with the style type. Please go to Step 1 and load model again.'
|
| 213 |
with torch.no_grad():
|
| 214 |
if self.color_transfer:
|
|
|
|
| 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 |
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)
|
| 234 |
if instyle is None or aligned_video is None or video_cap.get(7) == 0:
|
| 235 |
video_cap.release()
|
| 236 |
+
return 'default.mp4', 'Opps, something wrong with the input. Please go to Step 2 and Rescale Video again. 2'
|
| 237 |
if self.style_name != style_type:
|
| 238 |
exstyle, _ = self.load_model(style_type)
|
| 239 |
if exstyle is None:
|
| 240 |
+
exstyle, _ = self.load_model(style_type)
|
| 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)
|