Badr AlKhamissi commited on
Commit
a8674f9
·
1 Parent(s): 74bceb0

cast image to numpy for gif

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -160,7 +160,7 @@ def init_shapes(svg_path, trainable: Mapping[str, bool]):
160
  def run_main_ex(word, semantic_concept, num_steps, seed):
161
  prompt_suffix = "minimal flat 2d vector. lineal color. trending on artstation"
162
  font_name = "ArefRuqaa"
163
- return list(next(run_main_app(semantic_concept, word, prompt_suffix, font_name, num_steps, seed, 100, 201, 30, 0.5, 0)))
164
 
165
  def run_main_app(semantic_concept, word, prompt_suffix, font_name, num_steps, seed, dist_loss_weight, pixel_dist_kernel_blur, pixel_dist_sigma, angeles_w, example=0):
166
 
@@ -222,7 +222,7 @@ def run_main_app(semantic_concept, word, prompt_suffix, font_name, num_steps, se
222
  img = img[:, :, 3:4] * img[:, :, :3] + torch.ones(img.shape[0], img.shape[1], 3, device=device) * (
223
  1 - img[:, :, 3:4])
224
  img = img[:, :, :3]
225
- gif_frames += [img]
226
 
227
 
228
  filename = os.path.join(cfg.experiment_dir, "video-svg", f"iter{step:04d}.svg")
 
160
  def run_main_ex(word, semantic_concept, num_steps, seed):
161
  prompt_suffix = "minimal flat 2d vector. lineal color. trending on artstation"
162
  font_name = "ArefRuqaa"
163
+ return list(next(run_main_app(semantic_concept, word, prompt_suffix, font_name, num_steps, seed, 100, 201, 30, 0.5, 1)))
164
 
165
  def run_main_app(semantic_concept, word, prompt_suffix, font_name, num_steps, seed, dist_loss_weight, pixel_dist_kernel_blur, pixel_dist_sigma, angeles_w, example=0):
166
 
 
222
  img = img[:, :, 3:4] * img[:, :, :3] + torch.ones(img.shape[0], img.shape[1], 3, device=device) * (
223
  1 - img[:, :, 3:4])
224
  img = img[:, :, :3]
225
+ gif_frames += [img.detach().cpu().numpy()]
226
 
227
 
228
  filename = os.path.join(cfg.experiment_dir, "video-svg", f"iter{step:04d}.svg")