Spaces:
Running
on
Zero
Running
on
Zero
AlekseyCalvin
commited on
Commit
•
6e29c5a
1
Parent(s):
db87474
Update app.py
Browse files
app.py
CHANGED
@@ -147,18 +147,23 @@ def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, seed, wi
|
|
147 |
prompt_mash = f"{trigger_word} {prompt}"
|
148 |
else:
|
149 |
prompt_mash = prompt
|
150 |
-
|
151 |
# Load LoRA weights
|
152 |
with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
|
153 |
if "weights" in selected_lora:
|
154 |
-
pipe.load_lora_weights(
|
155 |
-
pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora["repo"], lora_scale=[1.0])
|
156 |
-
pipe.set_adapters(["fast", selected_lora["repo"]], adapter_weights=[1.0, 1.0])
|
157 |
else:
|
158 |
-
pipe.load_lora_weights(
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
image = generate_image(prompt, negative_prompt, steps, seed, cfg_scale, width, height, lora_scale)
|
164 |
pipe.to("cpu")
|
@@ -220,7 +225,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
220 |
with gr.Column():
|
221 |
with gr.Row():
|
222 |
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=0.5, value=3)
|
223 |
-
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=
|
224 |
|
225 |
with gr.Row():
|
226 |
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
|
@@ -228,7 +233,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
228 |
|
229 |
with gr.Row():
|
230 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, randomize=True)
|
231 |
-
lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=2.0, step=0.01, value=0
|
232 |
|
233 |
gallery.select(
|
234 |
update_selection,
|
|
|
147 |
prompt_mash = f"{trigger_word} {prompt}"
|
148 |
else:
|
149 |
prompt_mash = prompt
|
150 |
+
|
151 |
# Load LoRA weights
|
152 |
with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
|
153 |
if "weights" in selected_lora:
|
154 |
+
pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora["repo"], lora_scale=[1.0], adapter_weights=lora_scale)
|
|
|
|
|
155 |
else:
|
156 |
+
pipe.load_lora_weights(lora_path, adapter_name=selected_lora["repo"], lora_scale=[1.0], adapter_weights=lora_scale)
|
157 |
+
# Load LoRA weights
|
158 |
+
# with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
|
159 |
+
# if "weights" in selected_lora:
|
160 |
+
# pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_name="soon", adapter_weights=[1.0], lora_scale=[1.0])
|
161 |
+
# pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"], adapter_name=selected_lora["repo"], lora_scale=[1.0])
|
162 |
+
# pipe.set_adapters(["fast", selected_lora["repo"]], adapter_weights=[1.0, 1.0])
|
163 |
+
# else:
|
164 |
+
# pipe.load_lora_weights("ostris/OpenFLUX.1", weight_name="openflux1-v0.1.0-fast-lora.safetensors", adapter_name="soon", adapter_weights=[1.0], lora_scale=[1.0])
|
165 |
+
# pipe.load_lora_weights(lora_path, adapter_name=selected_lora["repo"], lora_scale=[1.0])
|
166 |
+
# pipe.set_adapters(["fast", selected_lora["repo"]], adapter_weights=[1.0, 1.0])
|
167 |
|
168 |
image = generate_image(prompt, negative_prompt, steps, seed, cfg_scale, width, height, lora_scale)
|
169 |
pipe.to("cpu")
|
|
|
225 |
with gr.Column():
|
226 |
with gr.Row():
|
227 |
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=0.5, value=3)
|
228 |
+
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=20)
|
229 |
|
230 |
with gr.Row():
|
231 |
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
|
|
|
233 |
|
234 |
with gr.Row():
|
235 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, randomize=True)
|
236 |
+
lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=2.0, step=0.01, value=1.0)
|
237 |
|
238 |
gallery.select(
|
239 |
update_selection,
|