Update app.py
Browse files
app.py
CHANGED
@@ -454,15 +454,31 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
|
|
454 |
output_type="pil",
|
455 |
good_vae=good_vae,
|
456 |
):
|
457 |
-
# Debugging: Check image type
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
raise ValueError("Expected an image, but got a non-image value.")
|
462 |
yield img
|
463 |
final_image = img # Update final_image with the current image
|
464 |
return final_image
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
@spaces.GPU(duration=75)
|
468 |
def run_lora(prompt, cfg_scale, steps, 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, randomize_seed, seed, width, height, loras_state, image_input=None, progress=gr.Progress(track_tqdm=True)):
|
|
|
454 |
output_type="pil",
|
455 |
good_vae=good_vae,
|
456 |
):
|
457 |
+
print(f"Debug: Yielding image of type {type(img)}") # Debugging: Check image type
|
458 |
+
if isinstance(img, float):
|
459 |
+
print("Error: A float was returned instead of an image.") # Log if img is a float
|
460 |
+
raise ValueError("Expected an image, but got a float.") # Raise error if a float is found
|
|
|
461 |
yield img
|
462 |
final_image = img # Update final_image with the current image
|
463 |
return final_image
|
464 |
+
|
465 |
+
def generate_image_to_image(prompt_mash, image_input_path, image_strength, steps, cfg_scale, width, height, seed):
|
466 |
+
pipe_i2i.to("cuda")
|
467 |
+
generator = torch.Generator(device="cuda").manual_seed(seed)
|
468 |
+
image_input = load_image(image_input_path)
|
469 |
+
final_image = pipe_i2i(
|
470 |
+
prompt=prompt_mash,
|
471 |
+
image=image_input,
|
472 |
+
strength=image_strength,
|
473 |
+
num_inference_steps=steps,
|
474 |
+
guidance_scale=cfg_scale,
|
475 |
+
width=width,
|
476 |
+
height=height,
|
477 |
+
generator=generator,
|
478 |
+
joint_attention_kwargs={"scale": 1.0},
|
479 |
+
output_type="pil",
|
480 |
+
).images[0]
|
481 |
+
return final_image
|
482 |
|
483 |
@spaces.GPU(duration=75)
|
484 |
def run_lora(prompt, cfg_scale, steps, 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, randomize_seed, seed, width, height, loras_state, image_input=None, progress=gr.Progress(track_tqdm=True)):
|