multimodalart HF staff commited on
Commit
834c4bb
β€’
1 Parent(s): ca61eab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -47,7 +47,7 @@ def update_selection(selected_state: gr.SelectData):
47
  instance_prompt = sdxl_loras[selected_state.index][3]
48
  weight_name = sdxl_loras[selected_state.index][4]
49
  updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo})"
50
- use_with_diffusers = f"""
51
  ## Using [`{lora_repo}`](https://huggingface.co/{lora_repo})
52
 
53
  ## Use it with diffusers:
@@ -77,7 +77,7 @@ def update_selection(selected_state: gr.SelectData):
77
  - [Invoke AI guide](https://invoke-ai.github.io/InvokeAI/features/CONCEPTS/?h=lora#using-loras)
78
  - [SD.Next guide](https://github.com/vladmandic/automatic)
79
  - [AUTOMATIC1111 guide](https://stable-diffusion-art.com/lora/)
80
- """
81
  return (
82
  updated_text,
83
  instance_prompt,
@@ -87,7 +87,7 @@ def update_selection(selected_state: gr.SelectData):
87
  )
88
 
89
 
90
- def run_lora(prompt, negative, weight, selected_state):
91
  global last_lora, last_merged, pipe
92
 
93
  if negative == "":
@@ -108,14 +108,14 @@ def run_lora(prompt, negative, weight, selected_state):
108
  is_compatible = sdxl_loras[selected_state.index][5]
109
  if is_compatible:
110
  pipe.load_lora_weights(full_path_lora)
111
- cross_attention_kwargs = {"scale": weight}
112
  else:
113
  for weights_file in [full_path_lora]:
114
  if ";" in weights_file:
115
  weights_file, multiplier = weights_file.split(";")
116
- multiplier = float(weight)
117
  else:
118
- multiplier = 1.0
119
 
120
  lora_model, weights_sd = lora.create_network_from_weights(
121
  multiplier,
 
47
  instance_prompt = sdxl_loras[selected_state.index][3]
48
  weight_name = sdxl_loras[selected_state.index][4]
49
  updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo})"
50
+ use_with_diffusers = f'''
51
  ## Using [`{lora_repo}`](https://huggingface.co/{lora_repo})
52
 
53
  ## Use it with diffusers:
 
77
  - [Invoke AI guide](https://invoke-ai.github.io/InvokeAI/features/CONCEPTS/?h=lora#using-loras)
78
  - [SD.Next guide](https://github.com/vladmandic/automatic)
79
  - [AUTOMATIC1111 guide](https://stable-diffusion-art.com/lora/)
80
+ '''
81
  return (
82
  updated_text,
83
  instance_prompt,
 
87
  )
88
 
89
 
90
+ def run_lora(prompt, negative, lora_scale, selected_state):
91
  global last_lora, last_merged, pipe
92
 
93
  if negative == "":
 
108
  is_compatible = sdxl_loras[selected_state.index][5]
109
  if is_compatible:
110
  pipe.load_lora_weights(full_path_lora)
111
+ cross_attention_kwargs = {"scale": lora_scale}
112
  else:
113
  for weights_file in [full_path_lora]:
114
  if ";" in weights_file:
115
  weights_file, multiplier = weights_file.split(";")
116
+ multiplier = float(multiplier)
117
  else:
118
+ multiplier = lora_scale
119
 
120
  lora_model, weights_sd = lora.create_network_from_weights(
121
  multiplier,