Keltezaa commited on
Commit
c67c2e5
·
verified ·
1 Parent(s): e959a83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -483,12 +483,14 @@ def run_lora(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scal
483
  # Load LoRA weights with respective scales
484
  lora_names = []
485
  lora_weights = []
 
486
  with calculateDuration("Loading LoRA weights"):
487
  for idx, lora in enumerate(selected_loras):
488
  lora_name = f"lora_{idx}"
489
  lora_names.append(lora_name)
490
  print(f"Lora Name: {lora_name}")
491
- lora_weights.append(lora_scale_1 if idx == 0 else lora_scale_2)
 
492
  lora_path = lora['repo']
493
  weight_name = lora.get("weights")
494
  print(f"Lora Path: {lora_path}")
@@ -499,8 +501,8 @@ def run_lora(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scal
499
  low_cpu_mem_usage=True,
500
  adapter_name=lora_name
501
  )
502
- print("Loaded LoRAs:", lora_names)
503
- print("Adapter weights:", lora_weights)
504
  ## if image_input is not None:
505
  ## pipe_i2i.set_adapters(lora_names, adapter_weights=lora_weights)
506
  ## else:
 
483
  # Load LoRA weights with respective scales
484
  lora_names = []
485
  lora_weights = []
486
+ lora_scales = [lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4] # List of scales
487
  with calculateDuration("Loading LoRA weights"):
488
  for idx, lora in enumerate(selected_loras):
489
  lora_name = f"lora_{idx}"
490
  lora_names.append(lora_name)
491
  print(f"Lora Name: {lora_name}")
492
+ # Use the scale based on the index, ensuring it does not exceed the list length
493
+ lora_weights.append(lora_scales[idx] if idx < len(lora_scales) else lora_scale_4) # Default to last scale if out of bounds
494
  lora_path = lora['repo']
495
  weight_name = lora.get("weights")
496
  print(f"Lora Path: {lora_path}")
 
501
  low_cpu_mem_usage=True,
502
  adapter_name=lora_name
503
  )
504
+ print("Loaded LoRAs:", lora_names)
505
+ print("Adapter weights:", lora_weights)
506
  ## if image_input is not None:
507
  ## pipe_i2i.set_adapters(lora_names, adapter_weights=lora_weights)
508
  ## else: