multimodalart HF staff commited on
Commit
d85302e
1 Parent(s): 9ae6468

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -139,16 +139,14 @@ def run_lora(prompt, image_input, image_strength, cfg_scale, steps, selected_ind
139
 
140
  # Load LoRA weights
141
  with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
142
- if(image_input is not None):
143
- if "weights" in selected_lora:
144
- pipe_i2i.load_lora_weights(lora_path, weight_name=selected_lora["weights"])
145
- else:
146
- pipe_i2i.load_lora_weights(lora_path)
147
- else:
148
- if "weights" in selected_lora:
149
- pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"])
150
- else:
151
- pipe.load_lora_weights(lora_path)
152
 
153
  # Set random seed for reproducibility
154
  with calculateDuration("Randomizing seed"):
 
139
 
140
  # Load LoRA weights
141
  with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
142
+ pipe_to_use = pipe_i2i if image_input is not None else pipe
143
+ weight_name = selected_lora.get("weights", None)
144
+
145
+ pipe_to_use.load_lora_weights(
146
+ lora_path,
147
+ weight_name=weight_name,
148
+ low_cpu_mem_usage=False
149
+ )
 
 
150
 
151
  # Set random seed for reproducibility
152
  with calculateDuration("Randomizing seed"):