AlekseyCalvin commited on
Commit
617f900
·
verified ·
1 Parent(s): f5adb7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -137,13 +137,13 @@ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, wid
137
  # Load LoRA weights
138
  with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
139
  if "weights" in selected_lora:
140
- pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora['title'], adapter_weights=lora_scale)
141
  pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_name="fast", adapter_weights=[1.0])
142
- pipe.set_adapters(["fast", 'title'], adapter_weights=[1.0, lora_scale])
143
  else:
144
- pipe.load_lora_weights(lora_path, adapter_name=selected_lora['title'], adapter_weights=lora_scale)
145
  pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_name="fast", adapter_weights=[1.0])
146
- pipe.set_adapters(["fast", 'title'], adapter_weights=[1.0, lora_scale])
147
 
148
  # Set random seed for reproducibility
149
  with calculateDuration("Randomizing seed"):
@@ -210,13 +210,13 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
210
  steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=5)
211
 
212
  with gr.Row():
213
- width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=768)
214
  height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
215
 
216
  with gr.Row():
217
  randomize_seed = gr.Checkbox(True, label="Randomize seed")
218
  seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, randomize=True)
219
- lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=2.0, step=0.01, value=0.8)
220
 
221
  gallery.select(
222
  update_selection,
 
137
  # Load LoRA weights
138
  with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
139
  if "weights" in selected_lora:
140
+ pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora["repo"], adapter_weights=lora_scale)
141
  pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_name="fast", adapter_weights=[1.0])
142
+ pipe.set_adapters({"fast", selected_lora["repo"]}, adapter_weights=[1.0, lora_scale])
143
  else:
144
+ pipe.load_lora_weights(lora_path, adapter_name=selected_lora["repo"], adapter_weights=lora_scale)
145
  pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_name="fast", adapter_weights=[1.0])
146
+ pipe.set_adapters({"fast", selected_lora["repo"]}, adapter_weights=[1.0, lora_scale])
147
 
148
  # Set random seed for reproducibility
149
  with calculateDuration("Randomizing seed"):
 
210
  steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=5)
211
 
212
  with gr.Row():
213
+ width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
214
  height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
215
 
216
  with gr.Row():
217
  randomize_seed = gr.Checkbox(True, label="Randomize seed")
218
  seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, randomize=True)
219
+ lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=2.0, step=0.01, value=0.85)
220
 
221
  gallery.select(
222
  update_selection,