Manjushri commited on
Commit
c3e0a32
1 Parent(s): f43cb42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -14,13 +14,12 @@ refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-ref
14
  refiner.enable_xformers_memory_efficient_attention()
15
  refiner = refiner.to(device)
16
 
17
- def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale):
18
  generator = np.random.seed(0) if seed == 0 else torch.manual_seed(seed)
19
  if upscale == "Yes":
20
  #n_steps = 30
21
- #high_noise_frac = 0.95
22
  int_image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
23
- image = refiner(Prompt, negative_prompt=negative_prompt, image=int_image).images[0]
24
  return (int_image, image)
25
  else:
26
  image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
@@ -34,7 +33,7 @@ gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generat
34
  gr.Slider(25, maximum=100, value=50, step=25, label='Number of Iterations'),
35
  gr.Slider(minimum=0, step=1, maximum=9999999999999999, randomize=True, label='Seed: 0 is Random'),
36
  gr.Radio(["Yes", "No"], label='SDXL 1.0 Refiner', value='No'),
37
- ],
38
  outputs=[gr.Image(label='Generated Image'), gr.Image(label='Generated Image')],
39
  title="PhotoReal V3.6 with SD x2 Upscaler - GPU",
40
  description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
 
14
  refiner.enable_xformers_memory_efficient_attention()
15
  refiner = refiner.to(device)
16
 
17
+ def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale, high_noise_frac):
18
  generator = np.random.seed(0) if seed == 0 else torch.manual_seed(seed)
19
  if upscale == "Yes":
20
  #n_steps = 30
 
21
  int_image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
22
+ image = refiner(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
23
  return (int_image, image)
24
  else:
25
  image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
 
33
  gr.Slider(25, maximum=100, value=50, step=25, label='Number of Iterations'),
34
  gr.Slider(minimum=0, step=1, maximum=9999999999999999, randomize=True, label='Seed: 0 is Random'),
35
  gr.Radio(["Yes", "No"], label='SDXL 1.0 Refiner', value='No'),
36
+ gr.Slider(minimum=.7, maximum=.99, value=.8, step=.01, label='Refiner Denoise %')],
37
  outputs=[gr.Image(label='Generated Image'), gr.Image(label='Generated Image')],
38
  title="PhotoReal V3.6 with SD x2 Upscaler - GPU",
39
  description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",