Spaces:
Running
on
Zero
Running
on
Zero
AlekseyCalvin
commited on
Commit
•
e02be13
1
Parent(s):
5511562
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ with open('loras.json', 'r') as f:
|
|
14 |
loras = json.load(f)
|
15 |
|
16 |
# Initialize the base model
|
17 |
-
base_model = "
|
18 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16)
|
19 |
|
20 |
MAX_SEED = 2**32-1
|
@@ -71,7 +71,7 @@ def infer(prompt, negative_prompt, trigger_word, steps, seed, cfg_scale, width,
|
|
71 |
width=width,
|
72 |
height=height,
|
73 |
generator=generator,
|
74 |
-
|
75 |
).images[0]
|
76 |
return image
|
77 |
|
@@ -87,8 +87,10 @@ def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, randomiz
|
|
87 |
with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
|
88 |
if "weights" in selected_lora:
|
89 |
pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"])
|
|
|
90 |
else:
|
91 |
pipe.load_lora_weights(lora_path)
|
|
|
92 |
|
93 |
# Set random seed for reproducibility
|
94 |
with calculateDuration("Randomizing seed"):
|
@@ -149,8 +151,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
149 |
with gr.Accordion("Advanced Settings", open=True):
|
150 |
with gr.Column():
|
151 |
with gr.Row():
|
152 |
-
cfg_scale = gr.Slider(label="CFG Scale", minimum=0, maximum=20, step=.5, value=
|
153 |
-
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=
|
154 |
|
155 |
with gr.Row():
|
156 |
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
|
|
|
14 |
loras = json.load(f)
|
15 |
|
16 |
# Initialize the base model
|
17 |
+
base_model = "ariG23498/sd-3.5-merged"
|
18 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16)
|
19 |
|
20 |
MAX_SEED = 2**32-1
|
|
|
71 |
width=width,
|
72 |
height=height,
|
73 |
generator=generator,
|
74 |
+
lora_scale=lora_scale,
|
75 |
).images[0]
|
76 |
return image
|
77 |
|
|
|
87 |
with calculateDuration(f"Loading LoRA weights for {selected_lora['title']}"):
|
88 |
if "weights" in selected_lora:
|
89 |
pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"])
|
90 |
+
pipe.fuse_lora(lora_scale=1.0)
|
91 |
else:
|
92 |
pipe.load_lora_weights(lora_path)
|
93 |
+
pipe.fuse_lora(lora_scale=1.0)
|
94 |
|
95 |
# Set random seed for reproducibility
|
96 |
with calculateDuration("Randomizing seed"):
|
|
|
151 |
with gr.Accordion("Advanced Settings", open=True):
|
152 |
with gr.Column():
|
153 |
with gr.Row():
|
154 |
+
cfg_scale = gr.Slider(label="CFG Scale", minimum=0, maximum=20, step=.5, value=1.5)
|
155 |
+
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=8)
|
156 |
|
157 |
with gr.Row():
|
158 |
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
|