Spaces:
Runtime error
Runtime error
still trying to fix issue
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import sys
|
|
| 10 |
import imageio
|
| 11 |
import numpy as np
|
| 12 |
|
| 13 |
-
sys.path.append('./code')
|
| 14 |
|
| 15 |
sys.path.append('/home/user/app/code')
|
| 16 |
|
|
@@ -236,11 +236,6 @@ def run_main_app(semantic_concept, word, script, prompt_suffix, font_name, num_s
|
|
| 236 |
# compose image with white background
|
| 237 |
img = img[:, :, 3:4] * img[:, :, :3] + torch.ones(img.shape[0], img.shape[1], 3, device=device) * (1 - img[:, :, 3:4])
|
| 238 |
img = img[:, :, :3]
|
| 239 |
-
|
| 240 |
-
if step % skip == 0:
|
| 241 |
-
img_tensor = img.detach().cpu()
|
| 242 |
-
img_tensor = torch.nn.functional.interpolate(img_tensor, size=(200, 200, 3), mode='bicubic', align_corners=False)
|
| 243 |
-
gif_frames += [img_tensor.numpy()]
|
| 244 |
|
| 245 |
filename = os.path.join(cfg.experiment_dir, "video-svg", f"iter{step:04d}.svg")
|
| 246 |
check_and_create_dir(filename)
|
|
@@ -249,6 +244,13 @@ def run_main_app(semantic_concept, word, script, prompt_suffix, font_name, num_s
|
|
| 249 |
yield gr.update(visible=True),gr.update(value=filename, label=f'iters: {step} / {num_iter}', visible=True),gr.update(visible=False),gr.update(value=cfg.caption,visible=True),gr.update(value=cfg.seed,visible=True)
|
| 250 |
|
| 251 |
x = img.unsqueeze(0).permute(0, 3, 1, 2) # HWC -> NCHW
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
x = x.repeat(cfg.batch_size, 1, 1, 1)
|
| 253 |
x_aug = data_augs.forward(x)
|
| 254 |
|
|
|
|
| 10 |
import imageio
|
| 11 |
import numpy as np
|
| 12 |
|
| 13 |
+
# sys.path.append('./code')
|
| 14 |
|
| 15 |
sys.path.append('/home/user/app/code')
|
| 16 |
|
|
|
|
| 236 |
# compose image with white background
|
| 237 |
img = img[:, :, 3:4] * img[:, :, :3] + torch.ones(img.shape[0], img.shape[1], 3, device=device) * (1 - img[:, :, 3:4])
|
| 238 |
img = img[:, :, :3]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
filename = os.path.join(cfg.experiment_dir, "video-svg", f"iter{step:04d}.svg")
|
| 241 |
check_and_create_dir(filename)
|
|
|
|
| 244 |
yield gr.update(visible=True),gr.update(value=filename, label=f'iters: {step} / {num_iter}', visible=True),gr.update(visible=False),gr.update(value=cfg.caption,visible=True),gr.update(value=cfg.seed,visible=True)
|
| 245 |
|
| 246 |
x = img.unsqueeze(0).permute(0, 3, 1, 2) # HWC -> NCHW
|
| 247 |
+
|
| 248 |
+
if step % skip == 0:
|
| 249 |
+
img_tensor = x.detach().cpu()
|
| 250 |
+
img_tensor = torch.nn.functional.interpolate(img_tensor, size=(200, 200), mode='bicubic', align_corners=False)
|
| 251 |
+
img_tensor = img_tensor.permute(0, 3, 2, 1).squeeze(0)
|
| 252 |
+
gif_frames += [img_tensor.numpy()]
|
| 253 |
+
|
| 254 |
x = x.repeat(cfg.batch_size, 1, 1, 1)
|
| 255 |
x_aug = data_augs.forward(x)
|
| 256 |
|