Krebzonide commited on
Commit
b550dc4
·
1 Parent(s): fa66b11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -58,7 +58,7 @@ def generate(prompt, neg_prompt, samp_steps, cfg_scale, batch_size, seed, height
58
  width=width,
59
  generator=torch.manual_seed(seed),
60
  ).images
61
- return [(img, f"Image {i+1}") for i, img in enumerate(images)]
62
 
63
  def set_base_model(base_model_id):
64
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
@@ -106,16 +106,19 @@ with gr.Blocks(css=css) as demo:
106
  with gr.Row():
107
  samp_steps = gr.Slider(1, 50, value=20, step=1, label="Sampling steps")
108
  cfg_scale = gr.Slider(1, 10, value=3, step=0.5, label="Guidance scale")
109
- batch_size = gr.Slider(1, 6, value=1, step=1, label="Batch size")
110
  with gr.Row():
111
- height = gr.Slider(label="Height", value=1024, minimum=8, maximum=2560, step=8)
112
  width = gr.Slider(label="Width", value=1024, minimum=8, maximum=2560, step=8)
113
  with gr.Row():
114
  pixels = gr.Number(label="Pixel Ratio", value=1, interactive=False)
115
  seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
116
  gallery = gr.Gallery(label="Generated images")
 
 
 
117
  ex = gr.Examples(examples=examples, inputs=[prompt, negative_prompt])
118
- submit_btn.click(generate, [prompt, negative_prompt, samp_steps, cfg_scale, batch_size, seed, height, width], [gallery], queue=True)
119
  height.release(update_pixel_ratio, [height, width], [pixels, height], queue=False)
120
  width.release(update_pixel_ratio, [width, height], [pixels, width], queue=False)
121
 
 
58
  width=width,
59
  generator=torch.manual_seed(seed),
60
  ).images
61
+ return [(img, f"Image {i+1}") for i, img in enumerate(images), seed]
62
 
63
  def set_base_model(base_model_id):
64
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
 
106
  with gr.Row():
107
  samp_steps = gr.Slider(1, 50, value=20, step=1, label="Sampling steps")
108
  cfg_scale = gr.Slider(1, 10, value=3, step=0.5, label="Guidance scale")
109
+ batch_size = gr.Slider(1, 4, value=1, step=1, label="Batch size")
110
  with gr.Row():
111
+ height = gr.Slider(label="Height", value=1024, minimum=8, maximum=1536, step=8)
112
  width = gr.Slider(label="Width", value=1024, minimum=8, maximum=2560, step=8)
113
  with gr.Row():
114
  pixels = gr.Number(label="Pixel Ratio", value=1, interactive=False)
115
  seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
116
  gallery = gr.Gallery(label="Generated images")
117
+ with gr.Row():
118
+ lastSeed = gr.Number(label="Last Seed", value=-1, interactive=False)
119
+
120
  ex = gr.Examples(examples=examples, inputs=[prompt, negative_prompt])
121
+ submit_btn.click(generate, [prompt, negative_prompt, samp_steps, cfg_scale, batch_size, seed, height, width], [gallery, lastSeed], queue=True)
122
  height.release(update_pixel_ratio, [height, width], [pixels, height], queue=False)
123
  width.release(update_pixel_ratio, [width, height], [pixels, width], queue=False)
124