flatindo commited on
Commit
acb5796
1 Parent(s): f17c551

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -18,7 +18,7 @@ current_steps = 25
18
  SAFETY_CHECKER = StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=torch.float16)
19
 
20
  UPSCALER = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
21
- UPSCALER.to("cuda")
22
  UPSCALER.enable_xformers_memory_efficient_attention()
23
 
24
 
@@ -40,7 +40,7 @@ class Model:
40
 
41
  models = [
42
  #Model("Stable Diffusion v1-4", "CompVis/stable-diffusion-v1-4"),
43
- # Model("Stable Diffusion v1-5", "runwayml/stable-diffusion-v1-5"),
44
  Model("anything-v4.0", "xyn-ai/anything-v4.0"),
45
  ]
46
 
@@ -125,7 +125,7 @@ def txt_to_img(
125
  ).images
126
 
127
  pipe.to("cpu")
128
- torch.cuda.empty_cache()
129
 
130
  return low_res_image[0], up_res_image[0]
131
 
 
18
  SAFETY_CHECKER = StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=torch.float16)
19
 
20
  UPSCALER = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
21
+ UPSCALER.to("cpu")
22
  UPSCALER.enable_xformers_memory_efficient_attention()
23
 
24
 
 
40
 
41
  models = [
42
  #Model("Stable Diffusion v1-4", "CompVis/stable-diffusion-v1-4"),
43
+ Model("Stable Diffusion v1-5", "runwayml/stable-diffusion-v1-5"),
44
  Model("anything-v4.0", "xyn-ai/anything-v4.0"),
45
  ]
46
 
 
125
  ).images
126
 
127
  pipe.to("cpu")
128
+ torch.cpu.empty_cache()
129
 
130
  return low_res_image[0], up_res_image[0]
131