Spaces:
Runtime error
Runtime error
move back
Browse files
infer.py
CHANGED
|
@@ -80,18 +80,7 @@ def infer_pipe_video(pipe, test_image, task_name, generator, device, latents=Non
|
|
| 80 |
else:
|
| 81 |
autocast_ctx = torch.autocast(pipe.device.type)
|
| 82 |
with autocast_ctx:
|
| 83 |
-
test_image = np.array(test_image).astype(np.
|
| 84 |
-
if max(test_image.shape[:2]) > 1024:
|
| 85 |
-
# resize for a maximum size of 1024
|
| 86 |
-
scale = 1024 / max(test_image.shape[:2])
|
| 87 |
-
elif min(test_image.shape[:2]) < 384:
|
| 88 |
-
# resize for a minimum size of 384
|
| 89 |
-
scale = 384 / min(test_image.shape[:2])
|
| 90 |
-
else:
|
| 91 |
-
scale = 1.0
|
| 92 |
-
new_shape = (int(test_image.shape[1] * scale), int(test_image.shape[0] * scale))
|
| 93 |
-
test_image = cv2.resize(test_image, new_shape)
|
| 94 |
-
test_image = test_image.astype(np.float16)
|
| 95 |
test_image = torch.tensor(test_image).permute(2,0,1).unsqueeze(0)
|
| 96 |
test_image = test_image / 127.5 - 1.0
|
| 97 |
test_image = test_image.to(device)
|
|
|
|
| 80 |
else:
|
| 81 |
autocast_ctx = torch.autocast(pipe.device.type)
|
| 82 |
with autocast_ctx:
|
| 83 |
+
test_image = np.array(test_image).astype(np.float16)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
test_image = torch.tensor(test_image).permute(2,0,1).unsqueeze(0)
|
| 85 |
test_image = test_image / 127.5 - 1.0
|
| 86 |
test_image = test_image.to(device)
|