TheAwakenOne commited on
Commit
fa075ae
·
1 Parent(s): f30e9ce
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -83,6 +83,26 @@ def update_selection(evt: gr.SelectData, width, height):
83
  gr.update(interactive=True) # Enable the Generate button
84
  )
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  @spaces.GPU(duration=70)
87
  def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, lora_scale, progress):
88
  pipe.to("cuda")
@@ -121,7 +141,7 @@ def generate_image_to_image(prompt_mash, image_input_path, image_strength, steps
121
  ).images[0]
122
  return final_image
123
 
124
- def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, width, height, lora_scale, progress=gr.Progress(track_tqdm=True)):
125
  global selected_lora_index
126
  if selected_lora_index is None:
127
  raise gr.Error("You must select a LoRA before proceeding.")
 
83
  gr.update(interactive=True) # Enable the Generate button
84
  )
85
 
86
+ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, width, height, lora_scale, progress=gr.Progress(track_tqdm=True)):
87
+ global selected_lora_index
88
+ if selected_lora_index is None:
89
+ raise gr.Error("You must select a LoRA before proceeding.")
90
+
91
+ selected_lora = loras[selected_lora_index]
92
+ lora_path = selected_lora["repo"]
93
+ trigger_word = selected_lora["trigger_word"]
94
+
95
+ if trigger_word:
96
+ if "trigger_position" in selected_lora:
97
+ if selected_lora["trigger_position"] == "prepend":
98
+ prompt_mash = f"{trigger_word} {prompt}"
99
+ else:
100
+ prompt_mash = f"{prompt} {trigger_word}"
101
+ else:
102
+ prompt_mash = f"{trigger_word} {prompt}"
103
+ else:
104
+ prompt_mash = prompt
105
+
106
  @spaces.GPU(duration=70)
107
  def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, lora_scale, progress):
108
  pipe.to("cuda")
 
141
  ).images[0]
142
  return final_image
143
 
144
+ def run_lora(prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale, progress=gr.Progress(track_tqdm=True)):
145
  global selected_lora_index
146
  if selected_lora_index is None:
147
  raise gr.Error("You must select a LoRA before proceeding.")