Krebzonide commited on
Commit
9f0ced2
·
1 Parent(s): 76ca690

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -15,18 +15,17 @@ css = """
15
  }
16
  """
17
 
18
- def generate(prompt, samp_steps, batch_size, seed, progress=gr.Progress(track_tqdm=True)):
19
  if seed < 0:
20
  seed = random.randint(1,999999)
21
- images = txt2img(
22
  prompt,
23
  num_inference_steps=1,
24
- num_images_per_prompt=batch_size,
25
  guidance_scale=0.0,
26
  generator=torch.manual_seed(seed),
27
  ).images
28
- upscaled_images = [img.resize((1024,1024), 1) for img in images]
29
- final_images = img2img(
30
  prompt,
31
  num_inference_steps=samp_steps,
32
  guidance_scale=5,
@@ -57,13 +56,12 @@ with gr.Blocks(css=css) as demo:
57
 
58
  with gr.Row():
59
  sampling_steps = gr.Slider(1, 20, value=5, step=1, label="Sampling steps")
60
- batch_size = gr.Slider(1, 6, value=1, step=1, label="Batch size")
61
  seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
62
  lastSeed = gr.Number(label="Last Seed", value=-1, interactive=False)
63
 
64
  gallery = gr.Gallery(show_label=False, preview=True, container=False, height=650)
65
 
66
- submit_btn.click(generate, [prompt, sampling_steps, batch_size, seed], [gallery, lastSeed], queue=True)
67
 
68
  txt2img, img2img = set_base_models()
69
  demo.launch(debug=True)
 
15
  }
16
  """
17
 
18
+ def generate(prompt, samp_steps, seed, progress=gr.Progress(track_tqdm=True)):
19
  if seed < 0:
20
  seed = random.randint(1,999999)
21
+ image = txt2img(
22
  prompt,
23
  num_inference_steps=1,
 
24
  guidance_scale=0.0,
25
  generator=torch.manual_seed(seed),
26
  ).images
27
+ upscaled_image = image.resize((1024,1024), 1)
28
+ final_image = img2img(
29
  prompt,
30
  num_inference_steps=samp_steps,
31
  guidance_scale=5,
 
56
 
57
  with gr.Row():
58
  sampling_steps = gr.Slider(1, 20, value=5, step=1, label="Sampling steps")
 
59
  seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
60
  lastSeed = gr.Number(label="Last Seed", value=-1, interactive=False)
61
 
62
  gallery = gr.Gallery(show_label=False, preview=True, container=False, height=650)
63
 
64
+ submit_btn.click(generate, [prompt, sampling_steps, seed], [gallery, lastSeed], queue=True)
65
 
66
  txt2img, img2img = set_base_models()
67
  demo.launch(debug=True)