Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -222,9 +222,9 @@ def load_loras(lora_strings_json:str):
|
|
222 |
adapter_names.append(adapter_name)
|
223 |
adapter_weights.append(adapter_weight)
|
224 |
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
|
229 |
try:
|
230 |
pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=adapter_name)
|
@@ -233,8 +233,8 @@ def load_loras(lora_strings_json:str):
|
|
233 |
continue
|
234 |
|
235 |
# set lora weights
|
236 |
-
|
237 |
-
|
238 |
|
239 |
|
240 |
def generate_control_image(image, mask, width, height):
|
@@ -325,8 +325,7 @@ def process(
|
|
325 |
result["message"] = "generate image failed"
|
326 |
print(e)
|
327 |
generated_image = None
|
328 |
-
|
329 |
-
clear_cuda_cache()
|
330 |
print("run flux finish")
|
331 |
if generated_image:
|
332 |
if upload_to_r2:
|
|
|
222 |
adapter_names.append(adapter_name)
|
223 |
adapter_weights.append(adapter_weight)
|
224 |
|
225 |
+
if adapter_name in active_adapters:
|
226 |
+
print(f"Adapter '{adapter_name}' is already loaded, skipping.")
|
227 |
+
continue
|
228 |
|
229 |
try:
|
230 |
pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=adapter_name)
|
|
|
233 |
continue
|
234 |
|
235 |
# set lora weights
|
236 |
+
if len(adapter_names) > 0:
|
237 |
+
pipe.set_adapters(adapter_names, adapter_weights=adapter_weights)
|
238 |
|
239 |
|
240 |
def generate_control_image(image, mask, width, height):
|
|
|
325 |
result["message"] = "generate image failed"
|
326 |
print(e)
|
327 |
generated_image = None
|
328 |
+
|
|
|
329 |
print("run flux finish")
|
330 |
if generated_image:
|
331 |
if upload_to_r2:
|