Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,6 +82,11 @@ def generate_image(orginal_image, prompt, adapter_names, steps, seed, image_str
|
|
| 82 |
|
| 83 |
with calculateDuration("Generating image"):
|
| 84 |
# Generate image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
if orginal_image:
|
| 86 |
generated_image = img2img(
|
| 87 |
prompt=prompt,
|
|
@@ -92,7 +97,7 @@ def generate_image(orginal_image, prompt, adapter_names, steps, seed, image_str
|
|
| 92 |
width=width,
|
| 93 |
height=height,
|
| 94 |
generator=generator,
|
| 95 |
-
joint_attention_kwargs=
|
| 96 |
).images[0]
|
| 97 |
else:
|
| 98 |
generated_image = pipe(
|
|
@@ -103,9 +108,10 @@ def generate_image(orginal_image, prompt, adapter_names, steps, seed, image_str
|
|
| 103 |
height=height,
|
| 104 |
max_sequence_length=512,
|
| 105 |
generator=generator,
|
| 106 |
-
joint_attention_kwargs=
|
| 107 |
).images[0]
|
| 108 |
-
|
|
|
|
| 109 |
progress(99, "Generate image success!")
|
| 110 |
return generated_image
|
| 111 |
|
|
|
|
| 82 |
|
| 83 |
with calculateDuration("Generating image"):
|
| 84 |
# Generate image
|
| 85 |
+
joint_attention_kwargs = {"scale": 1}
|
| 86 |
+
if len(adapter_names) == 0:
|
| 87 |
+
joint_attention_kwargs = None
|
| 88 |
+
pipe.unload_lora_weights()
|
| 89 |
+
|
| 90 |
if orginal_image:
|
| 91 |
generated_image = img2img(
|
| 92 |
prompt=prompt,
|
|
|
|
| 97 |
width=width,
|
| 98 |
height=height,
|
| 99 |
generator=generator,
|
| 100 |
+
joint_attention_kwargs=joint_attention_kwargs
|
| 101 |
).images[0]
|
| 102 |
else:
|
| 103 |
generated_image = pipe(
|
|
|
|
| 108 |
height=height,
|
| 109 |
max_sequence_length=512,
|
| 110 |
generator=generator,
|
| 111 |
+
joint_attention_kwargs=joint_attention_kwargs
|
| 112 |
).images[0]
|
| 113 |
+
if len(adapter_names) > 0:
|
| 114 |
+
pipe.unload_lora_weights()
|
| 115 |
progress(99, "Generate image success!")
|
| 116 |
return generated_image
|
| 117 |
|