Krebzonide
commited on
Commit
·
2839abc
1
Parent(s):
7e9a760
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ css = """
|
|
39 |
}
|
40 |
"""
|
41 |
|
42 |
-
def generate(prompt, neg_prompt, samp_steps, guide_scale, batch_size, seed, progress=gr.Progress(track_tqdm=True)):
|
43 |
if seed < 0:
|
44 |
seed = random.randint(1,999999)
|
45 |
images = pipe(
|
@@ -49,7 +49,8 @@ def generate(prompt, neg_prompt, samp_steps, guide_scale, batch_size, seed, prog
|
|
49 |
guidance_scale=guide_scale,
|
50 |
#cross_attention_kwargs={"scale": lora_scale},
|
51 |
num_images_per_prompt=lora_scale,
|
52 |
-
|
|
|
53 |
generator=torch.manual_seed(seed),
|
54 |
).images
|
55 |
return [(img, f"Image {i+1}") for i, img in enumerate(images)]
|
@@ -64,10 +65,13 @@ with gr.Blocks(css=css) as demo:
|
|
64 |
samp_steps = gr.Slider(1, 50, value=20, step=1, label="Sampling steps")
|
65 |
guide_scale = gr.Slider(1, 6, value=3, step=0.5, label="Guidance scale")
|
66 |
batch_size = gr.Slider(1, 6, value=1, step=1, label="Batch size")
|
67 |
-
|
|
|
|
|
|
|
68 |
gallery = gr.Gallery(label="Generated images", height=800)
|
69 |
|
70 |
-
submit_btn.click(generate, [prompt, negative_prompt, samp_steps, guide_scale, batch_size, seed], [gallery], queue=True)
|
71 |
|
72 |
demo.queue(1)
|
73 |
demo.launch(debug=True)
|
|
|
39 |
}
|
40 |
"""
|
41 |
|
42 |
+
def generate(prompt, neg_prompt, samp_steps, guide_scale, batch_size, seed, height, width, progress=gr.Progress(track_tqdm=True)):
|
43 |
if seed < 0:
|
44 |
seed = random.randint(1,999999)
|
45 |
images = pipe(
|
|
|
49 |
guidance_scale=guide_scale,
|
50 |
#cross_attention_kwargs={"scale": lora_scale},
|
51 |
num_images_per_prompt=lora_scale,
|
52 |
+
height=height,
|
53 |
+
width=width,
|
54 |
generator=torch.manual_seed(seed),
|
55 |
).images
|
56 |
return [(img, f"Image {i+1}") for i, img in enumerate(images)]
|
|
|
65 |
samp_steps = gr.Slider(1, 50, value=20, step=1, label="Sampling steps")
|
66 |
guide_scale = gr.Slider(1, 6, value=3, step=0.5, label="Guidance scale")
|
67 |
batch_size = gr.Slider(1, 6, value=1, step=1, label="Batch size")
|
68 |
+
with gr.Row():
|
69 |
+
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=999999, step=1)
|
70 |
+
height = gr.Slider(label="Height", value=1024, minumum-512, maximum=2048, step=8)
|
71 |
+
width = gr.Slider(label="Width", value=1024, minumum-512, maximum=2048, step=8)
|
72 |
gallery = gr.Gallery(label="Generated images", height=800)
|
73 |
|
74 |
+
submit_btn.click(generate, [prompt, negative_prompt, samp_steps, guide_scale, batch_size, seed, height, width], [gallery], queue=True)
|
75 |
|
76 |
demo.queue(1)
|
77 |
demo.launch(debug=True)
|