Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,7 +143,7 @@ def run_lora(prompt, image_url, lora_strings_json, image_strength, cfg_scale, s
|
|
| 143 |
|
| 144 |
with calculateDuration("Loading LoRA weights"):
|
| 145 |
adapter_weights = []
|
| 146 |
-
|
| 147 |
for idx, lora_info in enumerate(lora_configs):
|
| 148 |
lora_repo = lora_info.get("repo")
|
| 149 |
weights = lora_info.get("weights")
|
|
@@ -156,12 +156,14 @@ def run_lora(prompt, image_url, lora_strings_json, image_strength, cfg_scale, s
|
|
| 156 |
adapter_weights.append(adapter_weight)
|
| 157 |
if lora_repo and weights and adapter_name:
|
| 158 |
try:
|
|
|
|
| 159 |
txt2img_pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=lora_name)
|
| 160 |
except:
|
| 161 |
print("load lora error")
|
| 162 |
|
| 163 |
# set lora weights
|
| 164 |
if len(lora_names) > 0:
|
|
|
|
| 165 |
txt2img_pipe.set_adapters(lora_names, adapter_weights=adapter_weights)
|
| 166 |
|
| 167 |
# Generate image
|
|
|
|
| 143 |
|
| 144 |
with calculateDuration("Loading LoRA weights"):
|
| 145 |
adapter_weights = []
|
| 146 |
+
|
| 147 |
for idx, lora_info in enumerate(lora_configs):
|
| 148 |
lora_repo = lora_info.get("repo")
|
| 149 |
weights = lora_info.get("weights")
|
|
|
|
| 156 |
adapter_weights.append(adapter_weight)
|
| 157 |
if lora_repo and weights and adapter_name:
|
| 158 |
try:
|
| 159 |
+
txt2img_pipe.to(device)
|
| 160 |
txt2img_pipe.load_lora_weights(lora_repo, weight_name=weights, adapter_name=lora_name)
|
| 161 |
except:
|
| 162 |
print("load lora error")
|
| 163 |
|
| 164 |
# set lora weights
|
| 165 |
if len(lora_names) > 0:
|
| 166 |
+
txt2img_pipe.to(device)
|
| 167 |
txt2img_pipe.set_adapters(lora_names, adapter_weights=adapter_weights)
|
| 168 |
|
| 169 |
# Generate image
|