Update app.py
Browse files
app.py
CHANGED
@@ -430,14 +430,14 @@ def remove_custom_lora(selected_indices, current_loras, gallery):
|
|
430 |
lora_image_4 = lora4['image']
|
431 |
return (current_loras, gr.update(value=gallery_items), selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4)
|
432 |
|
433 |
-
def generate_image(
|
434 |
print("Generating image...")
|
435 |
pipe.to("cuda")
|
436 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
437 |
with calculateDuration("Generating image"):
|
438 |
# Generate image
|
439 |
for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
|
440 |
-
prompt=
|
441 |
num_inference_steps=steps,
|
442 |
guidance_scale=cfg_scale,
|
443 |
width=width,
|
@@ -447,7 +447,8 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
|
|
447 |
output_type="pil",
|
448 |
good_vae=good_vae,
|
449 |
):
|
450 |
-
|
|
|
451 |
return img
|
452 |
|
453 |
@spaces.GPU(duration=75)
|
|
|
430 |
lora_image_4 = lora4['image']
|
431 |
return (current_loras, gr.update(value=gallery_items), selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4)
|
432 |
|
433 |
+
def generate_image(prompt, steps, seed, cfg_scale, width, height, progress):
|
434 |
print("Generating image...")
|
435 |
pipe.to("cuda")
|
436 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
437 |
with calculateDuration("Generating image"):
|
438 |
# Generate image
|
439 |
for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
|
440 |
+
prompt=prompt,
|
441 |
num_inference_steps=steps,
|
442 |
guidance_scale=cfg_scale,
|
443 |
width=width,
|
|
|
447 |
output_type="pil",
|
448 |
good_vae=good_vae,
|
449 |
):
|
450 |
+
# Yielding a tuple with image, seed, and a progress update
|
451 |
+
yield img, seed, f"Generated image {img} with seed {seed}"
|
452 |
return img
|
453 |
|
454 |
@spaces.GPU(duration=75)
|