bobber commited on
Commit
5ae8d3f
·
verified ·
1 Parent(s): 1c5af3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -7,8 +7,8 @@ from diffusers import StableDiffusionXLPipeline
7
  pipeline = StableDiffusionXLPipeline.from_pretrained("bobber/bigasp2").to("cuda")
8
 
9
  @spaces.GPU
10
- def generate(prompt, negative_prompt, width, height, sample_steps):
11
- return pipeline(prompt=prompt, negative_prompt=negative_prompt, width=width, height=height, num_inference_steps=sample_steps).images[0]
12
 
13
  with gr.Blocks() as interface:
14
  with gr.Column():
@@ -27,8 +27,10 @@ with gr.Blocks() as interface:
27
  height = gr.Slider(label="Height", info="The height in pixels of the generated image.", value=1024, minimum=128, maximum=4096, step=64, interactive=True)
28
  with gr.Column():
29
  sampling_steps = gr.Slider(label="Sampling Steps", info="The number of denoising steps.", value=20, minimum=4, maximum=50, step=1, interactive=True)
 
 
30
 
31
- generate_button.click(fn=generate, inputs=[prompt, negative_prompt, width, height, sampling_steps], outputs=[output])
32
 
33
  if __name__ == "__main__":
34
  interface.launch()
 
7
  pipeline = StableDiffusionXLPipeline.from_pretrained("bobber/bigasp2").to("cuda")
8
 
9
  @spaces.GPU
10
+ def generate(prompt, negative_prompt, width, height, sample_steps, guidance_scale):
11
+ return pipeline(prompt=prompt, negative_prompt=negative_prompt, width=width, height=height, guidance_scale=guidance_scale, num_inference_steps=sample_steps).images[0]
12
 
13
  with gr.Blocks() as interface:
14
  with gr.Column():
 
27
  height = gr.Slider(label="Height", info="The height in pixels of the generated image.", value=1024, minimum=128, maximum=4096, step=64, interactive=True)
28
  with gr.Column():
29
  sampling_steps = gr.Slider(label="Sampling Steps", info="The number of denoising steps.", value=20, minimum=4, maximum=50, step=1, interactive=True)
30
+ with gr.Column():
31
+ guidance_scale = gr.Slider(label="Guidance Scale", info="Guidance scale.", value=2, minimum=1, maximum=10, step=0.1, interactive=True)
32
 
33
+ generate_button.click(fn=generate, inputs=[prompt, negative_prompt, width, height, sampling_steps, guidance_scale], outputs=[output])
34
 
35
  if __name__ == "__main__":
36
  interface.launch()