huzey commited on
Commit
ad83afa
1 Parent(s): f5298b9

fix image idx

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -3607,6 +3607,7 @@ with demo:
3607
  def run_heatmap(images, eigvecs, image1_slider, prompt_image1, n_eig, distance_slider, flat_idx=None, overlay_image=True):
3608
  gr.Info(f"current number of eigenvectors: {n_eig}")
3609
  eigvecs = torch.tensor(eigvecs)
 
3610
  images = [image[0] for image in images]
3611
  if isinstance(images[0], str):
3612
  images = [Image.open(image[0]).convert("RGB").resize((256, 256)) for image in images]
@@ -3859,6 +3860,7 @@ with demo:
3859
  def run_heatmap(images, eigvecs, image1_slider, prompt_image1, n_eig, distance_slider, flat_idx=None, overlay_image=True):
3860
  gr.Info(f"current number of eigenvectors: {n_eig}", 2)
3861
  eigvecs = torch.tensor(eigvecs)
 
3862
  images = [image[0] for image in images]
3863
  if isinstance(images[0], str):
3864
  images = [Image.open(image[0]).convert("RGB").resize((256, 256)) for image in images]
 
3607
  def run_heatmap(images, eigvecs, image1_slider, prompt_image1, n_eig, distance_slider, flat_idx=None, overlay_image=True):
3608
  gr.Info(f"current number of eigenvectors: {n_eig}")
3609
  eigvecs = torch.tensor(eigvecs)
3610
+ image1_slider = min(image1_slider, len(images)-1)
3611
  images = [image[0] for image in images]
3612
  if isinstance(images[0], str):
3613
  images = [Image.open(image[0]).convert("RGB").resize((256, 256)) for image in images]
 
3860
  def run_heatmap(images, eigvecs, image1_slider, prompt_image1, n_eig, distance_slider, flat_idx=None, overlay_image=True):
3861
  gr.Info(f"current number of eigenvectors: {n_eig}", 2)
3862
  eigvecs = torch.tensor(eigvecs)
3863
+ image1_slider = min(image1_slider, len(images)-1)
3864
  images = [image[0] for image in images]
3865
  if isinstance(images[0], str):
3866
  images = [Image.open(image[0]).convert("RGB").resize((256, 256)) for image in images]