Spaces:
Runtime error
Runtime error
Commit
•
fd9e499
1
Parent(s):
b12e444
Update app.py
Browse files
app.py
CHANGED
@@ -32,10 +32,11 @@ def run(prompt, negative_prompt="", guidance_scale=7.0, pag_scale=3.0, pag_layer
|
|
32 |
guidance_scale = 0.0
|
33 |
|
34 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
35 |
-
image_pag = pipe(prompt, guidance_scale=guidance_scale, pag_scale=pag_scale, pag_applied_layers=pag_layers, generator=generator, num_inference_steps=25).images[0]
|
36 |
|
37 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
38 |
-
image_normal = pipe(prompt, guidance_scale=guidance_scale, generator=generator, num_inference_steps=25).images[0]
|
|
|
39 |
return (image_pag, image_normal), seed
|
40 |
|
41 |
css = '''
|
@@ -55,7 +56,7 @@ with gr.Blocks(css=css, theme=theme) as demo:
|
|
55 |
button = gr.Button("Generate", min_width=120)
|
56 |
output = ImageSlider(label="Left: PAG, Right: No PAG", interactive=False)
|
57 |
with gr.Accordion("Advanced Settings", open=False):
|
58 |
-
guidance_scale = gr.Number(label="Guidance Scale", value=7.0)
|
59 |
negative_prompt = gr.Textbox(label="Negative prompt", info="Is only applied for the CFG part, leave blank for unconditional generation")
|
60 |
pag_scale = gr.Number(label="Pag Scale", value=3.0)
|
61 |
pag_layers = gr.Dropdown(label="Model layers to apply Pag to", info="mid is the one used on the paper, up and down blocks seem unstable", choices=["up", "mid", "down"], multiselect=True, value="mid")
|
|
|
32 |
guidance_scale = 0.0
|
33 |
|
34 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
35 |
+
image_pag = pipe(prompt, negative_prompt=negative_prompt, guidance_scale=guidance_scale, pag_scale=pag_scale, pag_applied_layers=pag_layers, generator=generator, num_inference_steps=25).images[0]
|
36 |
|
37 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
38 |
+
image_normal = pipe(prompt, negative_prompt=negative_prompt, guidance_scale=guidance_scale, generator=generator, num_inference_steps=25).images[0]
|
39 |
+
|
40 |
return (image_pag, image_normal), seed
|
41 |
|
42 |
css = '''
|
|
|
56 |
button = gr.Button("Generate", min_width=120)
|
57 |
output = ImageSlider(label="Left: PAG, Right: No PAG", interactive=False)
|
58 |
with gr.Accordion("Advanced Settings", open=False):
|
59 |
+
guidance_scale = gr.Number(label="CFG Guidance Scale", info="The guidance scale for CFG, ignored if no prompt is entered (unconditional generation)", value=7.0)
|
60 |
negative_prompt = gr.Textbox(label="Negative prompt", info="Is only applied for the CFG part, leave blank for unconditional generation")
|
61 |
pag_scale = gr.Number(label="Pag Scale", value=3.0)
|
62 |
pag_layers = gr.Dropdown(label="Model layers to apply Pag to", info="mid is the one used on the paper, up and down blocks seem unstable", choices=["up", "mid", "down"], multiselect=True, value="mid")
|