Krebzonide commited on
Commit
8553966
1 Parent(s): 308c05e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -16,12 +16,13 @@ css = """
16
  }
17
  """
18
 
19
- def generate(prompt, samp_steps, seed, progress=gr.Progress(track_tqdm=True)):
 
20
  if seed < 0:
21
  seed = random.randint(1,999999)
22
  image = txt2img(
23
  prompt,
24
- num_inference_steps=1,
25
  guidance_scale=0.0,
26
  generator=torch.manual_seed(seed),
27
  ).images[0]
@@ -58,13 +59,14 @@ with gr.Blocks(css=css) as demo:
58
  submit_btn = gr.Button("Generate", elem_classes="btn-green")
59
 
60
  with gr.Row():
 
61
  sampling_steps = gr.Slider(1, 6, value=3, step=1, label="Refiner steps")
62
  seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
63
  lastSeed = gr.Number(label="Last Seed", value=-1, interactive=False)
64
 
65
  gallery = gr.Gallery(show_label=False, preview=True, container=False, height=1100)
66
 
67
- submit_btn.click(generate, [prompt, sampling_steps, seed], [gallery, lastSeed], queue=True)
68
 
69
  txt2img, img2img = set_base_models()
70
  demo.launch(debug=True)
 
16
  }
17
  """
18
 
19
+ def generate(prompt, turbo_steps, samp_steps, seed, progress=gr.Progress(track_tqdm=True)):
20
+ print("prompt = ", prompt)
21
  if seed < 0:
22
  seed = random.randint(1,999999)
23
  image = txt2img(
24
  prompt,
25
+ num_inference_steps=turbo_steps,
26
  guidance_scale=0.0,
27
  generator=torch.manual_seed(seed),
28
  ).images[0]
 
59
  submit_btn = gr.Button("Generate", elem_classes="btn-green")
60
 
61
  with gr.Row():
62
+ turbo_steps = gr.Slider(1, 4, value=1, step=1, label="Turbo steps")
63
  sampling_steps = gr.Slider(1, 6, value=3, step=1, label="Refiner steps")
64
  seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
65
  lastSeed = gr.Number(label="Last Seed", value=-1, interactive=False)
66
 
67
  gallery = gr.Gallery(show_label=False, preview=True, container=False, height=1100)
68
 
69
+ submit_btn.click(generate, [prompt, turbo_steps, sampling_steps, seed], [gallery, lastSeed], queue=True)
70
 
71
  txt2img, img2img = set_base_models()
72
  demo.launch(debug=True)