ovi054 commited on
Commit
d3df5ac
·
verified ·
1 Parent(s): a77fff1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
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
- # --- 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")
 
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")