Fabrice-TIERCELIN commited on
Commit
9fd053d
·
verified ·
1 Parent(s): 0c1e4fd

has_end_image

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -643,8 +643,9 @@ def worker_start_end(input_image, end_image, image_position, prompts, n_prompt,
643
 
644
  H, W, C = input_image.shape
645
  height, width = find_nearest_bucket(H, W, resolution=resolution)
 
646
 
647
- def get_start_latent(input_image, end_image, height, width, vae, gpu, image_encoder, high_vram):
648
  input_image_np = resize_and_center_crop(input_image, target_width=width, target_height=height)
649
 
650
  Image.fromarray(input_image_np).save(os.path.join(outputs_folder, f'{job_id}_start.png'))
@@ -653,11 +654,9 @@ def worker_start_end(input_image, end_image, image_position, prompts, n_prompt,
653
  input_image_pt = input_image_pt.permute(2, 0, 1)[None, :, None]
654
 
655
  # Processing end image (if provided)
656
- has_end_image = end_image is not None
657
  if has_end_image:
658
  stream.output_queue.push(('progress', (None, '', make_progress_bar_html(0, 'Processing end frame ...'))))
659
 
660
- H_end, W_end, C_end = end_image.shape
661
  end_image_np = resize_and_center_crop(end_image, target_width=width, target_height=height)
662
 
663
  Image.fromarray(end_image_np).save(os.path.join(outputs_folder, f'{job_id}_end.png'))
@@ -699,7 +698,7 @@ def worker_start_end(input_image, end_image, image_position, prompts, n_prompt,
699
 
700
  return [start_latent, image_encoder_last_hidden_state]
701
 
702
- [start_latent, image_encoder_last_hidden_state] = get_start_latent(input_image, end_image, height, width, vae, gpu, image_encoder, high_vram)
703
 
704
  # Dtype
705
  image_encoder_last_hidden_state = image_encoder_last_hidden_state.to(transformer.dtype)
 
643
 
644
  H, W, C = input_image.shape
645
  height, width = find_nearest_bucket(H, W, resolution=resolution)
646
+ has_end_image = end_image is not None
647
 
648
+ def get_start_latent(input_image, has_end_image, end_image, height, width, vae, gpu, image_encoder, high_vram):
649
  input_image_np = resize_and_center_crop(input_image, target_width=width, target_height=height)
650
 
651
  Image.fromarray(input_image_np).save(os.path.join(outputs_folder, f'{job_id}_start.png'))
 
654
  input_image_pt = input_image_pt.permute(2, 0, 1)[None, :, None]
655
 
656
  # Processing end image (if provided)
 
657
  if has_end_image:
658
  stream.output_queue.push(('progress', (None, '', make_progress_bar_html(0, 'Processing end frame ...'))))
659
 
 
660
  end_image_np = resize_and_center_crop(end_image, target_width=width, target_height=height)
661
 
662
  Image.fromarray(end_image_np).save(os.path.join(outputs_folder, f'{job_id}_end.png'))
 
698
 
699
  return [start_latent, image_encoder_last_hidden_state]
700
 
701
+ [start_latent, image_encoder_last_hidden_state] = get_start_latent(input_image, has_end_image, end_image, height, width, vae, gpu, image_encoder, high_vram)
702
 
703
  # Dtype
704
  image_encoder_last_hidden_state = image_encoder_last_hidden_state.to(transformer.dtype)