Manjushri commited on
Commit
6df9545
1 Parent(s): ed90fbc

Update app.py

Browse files

Added Resolution Sliders
Added Clearer Instructions

Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -15,14 +15,14 @@ torch.cuda.max_memory_allocated(device='cuda')
15
  vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", torch_dtype=torch.float16)
16
  torch.cuda.empty_cache()
17
 
18
- def genie (prompt, negative_prompt, scale, steps, seed, upscaler):
19
  torch.cuda.max_memory_allocated(device='cuda')
20
  pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True, vae=vae)
21
  pipe = pipe.to(device)
22
  pipe.enable_xformers_memory_efficient_attention()
23
  torch.cuda.empty_cache()
24
  generator = torch.Generator(device=device).manual_seed(seed)
25
- int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator).images
26
  torch.cuda.empty_cache()
27
  if upscaler == 'Yes':
28
  torch.cuda.max_memory_allocated(device='cuda')
@@ -48,10 +48,13 @@ def genie (prompt, negative_prompt, scale, steps, seed, upscaler):
48
  torch.cuda.empty_cache()
49
  return (image, image)
50
 
51
- gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
52
- gr.Textbox(label='What you Do Not want the AI to generate.'),
53
- gr.Slider(1, 15, 10), gr.Slider(25, maximum=100, value=50, step=1),
54
- gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True),
 
 
 
55
  gr.Radio(['Yes', 'No'], label='Upscale?')],
56
  outputs=['image', 'image'],
57
  title="Stable Diffusion XL 0.9 GPU",
 
15
  vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", torch_dtype=torch.float16)
16
  torch.cuda.empty_cache()
17
 
18
+ def genie (prompt, negative_prompt, height, width, scale, steps, seed, upscaler):
19
  torch.cuda.max_memory_allocated(device='cuda')
20
  pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0.9", torch_dtype=torch.float16, variant="fp16", use_safetensors=True, vae=vae)
21
  pipe = pipe.to(device)
22
  pipe.enable_xformers_memory_efficient_attention()
23
  torch.cuda.empty_cache()
24
  generator = torch.Generator(device=device).manual_seed(seed)
25
+ int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, height=height, width=width, guidance_scale=scale, num_images_per_prompt=1, generator=generator).images
26
  torch.cuda.empty_cache()
27
  if upscaler == 'Yes':
28
  torch.cuda.max_memory_allocated(device='cuda')
 
48
  torch.cuda.empty_cache()
49
  return (image, image)
50
 
51
+ gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate.<b> 77 Token Limit. A Token is Any Word, Number, Symbol, or Punctuation. Everything Over 77 Will Be Truncated!'),
52
+ gr.Textbox(label='What you Do Not want the AI to generate. <b>77 Token Limit'),
53
+ gr.Slider(512, 1024, 768, step=128, label='Height'),
54
+ gr.Slider(512, 1024, 768, step=128, label='Width'),
55
+ gr.Slider(1, 15, 10, step=.25, label='Guidance Scale: How Closely the AI follows the Prompt'),
56
+ gr.Slider(25, maximum=100, value=50, step=25, label='Number of Iterations'),
57
+ gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True, label='Seed'),
58
  gr.Radio(['Yes', 'No'], label='Upscale?')],
59
  outputs=['image', 'image'],
60
  title="Stable Diffusion XL 0.9 GPU",