Keltezaa commited on
Commit
b329984
·
verified ·
1 Parent(s): cc7183b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -297,25 +297,24 @@ def generate_images(prompt_mash, steps, seed, cfg_scale, width, height, progress
297
  print("Generating multiple images...")
298
  pipe.to("cuda")
299
  images = []
300
-
301
  for _ in range(4): # Generate 4 images
302
  seed = random.randint(0, MAX_SEED)
303
  generator = torch.Generator(device="cuda").manual_seed(seed)
304
  with calculateDuration("Generating image"):
305
- for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
306
- prompt=prompt_mash,
307
- num_inference_steps=steps,
308
- guidance_scale=cfg_scale,
309
- width=width,
310
- height=height,
311
- generator=generator,
312
- joint_attention_kwargs={"scale": 1.0},
313
- output_type="pil",
314
- good_vae=good_vae,
315
- ):
316
- images.append((img, seed)) # Store image and its seed
317
- break # Only take the first generated image
318
-
319
  return images
320
 
321
  #def generate_image_to_image(prompt_mash, image_input_path, image_strength, steps, cfg_scale, width, height, seed):
@@ -334,7 +333,7 @@ def generate_images(prompt_mash, steps, seed, cfg_scale, width, height, progress
334
  # joint_attention_kwargs={"scale": 1.0},
335
  # output_type="pil",
336
  # ).images[0]
337
- return img
338
 
339
  @spaces.GPU(duration=75)
340
  def run_lora_multi(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state, progress=gr.Progress(track_tqdm=True)):
 
297
  print("Generating multiple images...")
298
  pipe.to("cuda")
299
  images = []
 
300
  for _ in range(4): # Generate 4 images
301
  seed = random.randint(0, MAX_SEED)
302
  generator = torch.Generator(device="cuda").manual_seed(seed)
303
  with calculateDuration("Generating image"):
304
+ img = next(
305
+ pipe.flux_pipe_call_that_returns_an_iterable_of_images(
306
+ prompt=prompt_mash,
307
+ num_inference_steps=steps,
308
+ guidance_scale=cfg_scale,
309
+ width=width,
310
+ height=height,
311
+ generator=generator,
312
+ joint_attention_kwargs={"scale": 1.0},
313
+ output_type="pil",
314
+ good_vae=good_vae,
315
+ )
316
+ )
317
+ images.append((img, seed))
318
  return images
319
 
320
  #def generate_image_to_image(prompt_mash, image_input_path, image_strength, steps, cfg_scale, width, height, seed):
 
333
  # joint_attention_kwargs={"scale": 1.0},
334
  # output_type="pil",
335
  # ).images[0]
336
+ # return img
337
 
338
  @spaces.GPU(duration=75)
339
  def run_lora_multi(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state, progress=gr.Progress(track_tqdm=True)):