AlekseyCalvin commited on
Commit
f1c229b
·
verified ·
1 Parent(s): ec75785

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -151,12 +151,15 @@ def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, seed, wi
151
  # Load LoRA weights
152
  with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
153
  if "weights" in selected_lora:
154
- pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_weights=[1.0])
155
- pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora["repo"], adapter_weights=[lora_scale])
 
156
  else:
157
- pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_weights=[1.0])
158
- pipe.load_lora_weights(lora_path, adapter_name=selected_lora["repo"], adapter_weights=[lora_scale])
159
-
 
 
160
  image = generate_image(prompt, negative_prompt, steps, seed, cfg_scale, width, height, lora_scale)
161
  pipe.to("cpu")
162
  pipe.unload_lora_weights()
 
151
  # Load LoRA weights
152
  with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
153
  if "weights" in selected_lora:
154
+ pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_weights=[1.0], lora_scale=[1.0])
155
+ pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora["repo"], lora_scale=[1.0], adapter_weights=selected_lora[lora_scale])
156
+ pipe.set_adapters(["fast", selected_lora["repo"]], adapter_weights=[1.0, selected_lora[lora_scale]])
157
  else:
158
+ pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_weights=[1.0], lora_scale=[1.0])
159
+ pipe.load_lora_weights(lora_path, adapter_name=selected_lora["repo"], adapter_weights=selected_lora[lora_scale])
160
+ pipe.set_adapters(["fast", selected_lora["repo"]], adapter_weights=[1.0, selected_lora[lora_scale]])
161
+
162
+
163
  image = generate_image(prompt, negative_prompt, steps, seed, cfg_scale, width, height, lora_scale)
164
  pipe.to("cpu")
165
  pipe.unload_lora_weights()