Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,24 +67,24 @@ def generate(prompt, negative_prompt, width=1024, height=1024, num_inference_ste
|
|
| 67 |
|
| 68 |
clean_lora_id = lora_id.strip() if lora_id else ""
|
| 69 |
|
| 70 |
-
try:
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
|
| 90 |
pipe.to("cuda")
|
|
|
|
| 67 |
|
| 68 |
clean_lora_id = lora_id.strip() if lora_id else ""
|
| 69 |
|
| 70 |
+
# try:
|
| 71 |
+
# --- IF LORA ID IS NONE, USE ONE LORA ---
|
| 72 |
+
if not clean_lora_id:
|
| 73 |
+
print("No custom LoRA provided. Using ONLY the base LoRA.")
|
| 74 |
+
# Activate just the default LoRA
|
| 75 |
+
pipe.set_adapters([DEFAULT_LORA_NAME], adapter_weights=[1.0])
|
| 76 |
+
|
| 77 |
+
# --- OTHERWISE, LOAD AND USE TWO LORAS ---
|
| 78 |
+
else:
|
| 79 |
+
print(f"Custom LoRA provided. Loading '{clean_lora_id}' and combining with base LoRA.")
|
| 80 |
+
# Load the custom LoRA fresh for this run
|
| 81 |
+
pipe.load_lora_weights(clean_lora_id, adapter_name=CUSTOM_LORA_NAME)
|
| 82 |
+
|
| 83 |
+
# Activate BOTH LoRAs together
|
| 84 |
+
pipe.set_adapters(
|
| 85 |
+
[DEFAULT_LORA_NAME, CUSTOM_LORA_NAME],
|
| 86 |
+
adapter_weights=[1.0, 1.0] # Strength for base, strength for custom
|
| 87 |
+
)
|
| 88 |
|
| 89 |
|
| 90 |
pipe.to("cuda")
|