StaticExposure commited on
Commit
6d5a4e6
·
verified ·
1 Parent(s): 38bfc8d

Fix: reattach @spaces.GPU to run_lora; helper defs moved above decorator (fixes SyntaxError and moves LoRA download out of the GPU window)

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -178,8 +178,6 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, lora_scal
178
 
179
  return image
180
 
181
- @spaces.GPU(duration=120)
182
-
183
  _STYLE_SD_CACHE = {}
184
 
185
  def _prefetch_style_lora(lora_path, weight_name=None):
@@ -216,6 +214,7 @@ def _load_style_lora(pipe, lora_path, weight_name=None):
216
  print("[patch] remap loader failed (" + repr(e) + "), falling back")
217
  pipe.load_lora_weights(lora_path, weight_name=weight_name, low_cpu_mem_usage=True, adapter_name="style")
218
 
 
219
  def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, aspect_ratio, lora_scale, speed_mode, progress=gr.Progress(track_tqdm=True)):
220
  if selected_index is None:
221
  raise gr.Error("You must select a LoRA before proceeding.")
 
178
 
179
  return image
180
 
 
 
181
  _STYLE_SD_CACHE = {}
182
 
183
  def _prefetch_style_lora(lora_path, weight_name=None):
 
214
  print("[patch] remap loader failed (" + repr(e) + "), falling back")
215
  pipe.load_lora_weights(lora_path, weight_name=weight_name, low_cpu_mem_usage=True, adapter_name="style")
216
 
217
+ @spaces.GPU(duration=120)
218
  def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, aspect_ratio, lora_scale, speed_mode, progress=gr.Progress(track_tqdm=True)):
219
  if selected_index is None:
220
  raise gr.Error("You must select a LoRA before proceeding.")