Emma02 commited on
Commit
e073966
·
verified ·
1 Parent(s): 013c962

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -47,10 +47,6 @@ def main(_):
47
  use_lock=False,
48
  )
49
 
50
- checkerboard_r1 = np.concatenate([np.zeros((8, 8, 3)), np.ones((8, 8, 3)), np.zeros((8, 8, 3))], axis=1)
51
- checkerboard_r2 = np.concatenate([np.ones((8, 8, 3)), np.zeros((8, 8, 3)), np.ones((8, 8, 3))], axis=1)
52
- checkerboard = np.concatenate([checkerboard_r1, checkerboard_r2] * 16, axis=0).astype(np.float32)
53
-
54
  def generate_images(input_images, n_new_frames, n_candidates, temperature=1.0, top_p=0.9):
55
  assert len(input_images) > 0
56
  input_images = [
@@ -62,14 +58,14 @@ def main(_):
62
 
63
  generated_images = []
64
  for candidate in output_images:
65
- concatenated_image = []
66
- for i, img in enumerate(candidate):
67
- concatenated_image.append(img)
68
- if i < len(candidate) - 1:
69
- concatenated_image.append(checkerboard)
70
  generated_images.append(
71
  Image.fromarray(
72
- (np.concatenate(concatenated_image, axis=1) * 255).astype(np.uint8)
73
  )
74
  )
75
 
@@ -247,4 +243,3 @@ def main(_):
247
 
248
  if __name__ == "__main__":
249
  mlxu.run(main)
250
-
 
47
  use_lock=False,
48
  )
49
 
 
 
 
 
50
  def generate_images(input_images, n_new_frames, n_candidates, temperature=1.0, top_p=0.9):
51
  assert len(input_images) > 0
52
  input_images = [
 
58
 
59
  generated_images = []
60
  for candidate in output_images:
61
+ concatenated_rows = []
62
+ for i in range(len(candidate)):
63
+ concatenated_row = np.concatenate([input_images[i]] + candidate, axis=1)
64
+ concatenated_rows.append(concatenated_row)
65
+ combined_image = np.concatenate(concatenated_rows, axis=0)
66
  generated_images.append(
67
  Image.fromarray(
68
+ (combined_image * 255).astype(np.uint8)
69
  )
70
  )
71
 
 
243
 
244
  if __name__ == "__main__":
245
  mlxu.run(main)