Manjushri commited on
Commit
fa62e06
1 Parent(s): a3f33c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -114,14 +114,17 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
114
  sdxl = sdxl.to(device)
115
  sdxl.enable_xformers_memory_efficient_attention()
116
  torch.cuda.empty_cache()
 
 
 
117
  if upscale == "Yes":
118
- int_image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
119
- image = refiner(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
 
120
  torch.cuda.empty_cache()
121
- return image
122
- else:
123
- image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
124
  torch.cuda.empty_cache()
 
125
 
126
  return image
127
 
 
114
  sdxl = sdxl.to(device)
115
  sdxl.enable_xformers_memory_efficient_attention()
116
  torch.cuda.empty_cache()
117
+ image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
118
+ torch.cuda.empty_cache()
119
+
120
  if upscale == "Yes":
121
+ sdxl = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16") if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0")
122
+ sdxl.enable_xformers_memory_efficient_attention()
123
+ sdxl = sdxl.to(device)
124
  torch.cuda.empty_cache()
125
+ refined = sdxl(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
 
 
126
  torch.cuda.empty_cache()
127
+ return refined
128
 
129
  return image
130