multimodalart HF Staff commited on
Commit
999f6b7
·
verified ·
1 Parent(s): 103dcd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -22,9 +22,9 @@ def split_image(input_image, num_splits=4):
22
 
23
  # Split the image into four 256x256 sections
24
  for i in range(num_splits):
25
- left = i * 256
26
- right = (i + 1) * 256
27
- box = (left, 0, right, 256)
28
  output_images.append(input_image.crop(box))
29
 
30
  return output_images
@@ -37,7 +37,7 @@ pipe.to(device=device, dtype=torch_dtype)
37
  MAX_SEED = np.iinfo(np.int32).max
38
 
39
  @spaces.GPU
40
- def infer(prompt, seed=42, randomize_seed=False, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
41
  prompt_template = f"A side by side 4 frame image showing consecutive stills from a looped gif moving from left to right. The stills are of {prompt}"
42
  if randomize_seed:
43
  seed = random.randint(0, MAX_SEED)
@@ -49,8 +49,8 @@ def infer(prompt, seed=42, randomize_seed=False, num_inference_steps=4, progress
49
  num_inference_steps=num_inference_steps,
50
  num_images_per_prompt=1,
51
  generator=torch.Generator(device).manual_seed(seed),
52
- height=256,
53
- width=1024
54
  ).images[0]
55
  gif_name = f"{uuid.uuid4().hex}-flux.gif"
56
  export_to_gif(split_image(image, 4), gif_name, fps=4)
 
22
 
23
  # Split the image into four 256x256 sections
24
  for i in range(num_splits):
25
+ left = i * 384
26
+ right = (i + 1) * 384
27
+ box = (left, 0, right, 384)
28
  output_images.append(input_image.crop(box))
29
 
30
  return output_images
 
37
  MAX_SEED = np.iinfo(np.int32).max
38
 
39
  @spaces.GPU
40
+ def infer(prompt, seed=1, randomize_seed=False, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
41
  prompt_template = f"A side by side 4 frame image showing consecutive stills from a looped gif moving from left to right. The stills are of {prompt}"
42
  if randomize_seed:
43
  seed = random.randint(0, MAX_SEED)
 
49
  num_inference_steps=num_inference_steps,
50
  num_images_per_prompt=1,
51
  generator=torch.Generator(device).manual_seed(seed),
52
+ height=384,
53
+ width=1152
54
  ).images[0]
55
  gif_name = f"{uuid.uuid4().hex}-flux.gif"
56
  export_to_gif(split_image(image, 4), gif_name, fps=4)