fffiloni commited on
Commit
0af1d8d
1 Parent(s): e63a721

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -16
app.py CHANGED
@@ -13,7 +13,20 @@ import numpy as np
13
  import cv2
14
 
15
  #vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
16
-
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  generator = torch.Generator(device="cuda")
18
 
19
  #pipe.enable_model_cpu_offload()
@@ -30,21 +43,6 @@ def infer(use_custom_model, model_name, image_in, prompt, preprocessor, controln
30
 
31
  if preprocessor == "canny":
32
 
33
- controlnet = ControlNetModel.from_pretrained(
34
- "diffusers/controlnet-canny-sdxl-1.0",
35
- torch_dtype=torch.float16
36
- )
37
-
38
- pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
39
- "stabilityai/stable-diffusion-xl-base-1.0",
40
- controlnet=controlnet,
41
- #vae=vae,
42
- torch_dtype=torch.float16,
43
- variant="fp16",
44
- use_safetensors=True
45
- )
46
- pipe.to("cuda")
47
-
48
  image = load_image(image_in)
49
 
50
  image = np.array(image)
 
13
  import cv2
14
 
15
  #vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
16
+ controlnet = ControlNetModel.from_pretrained(
17
+ "diffusers/controlnet-canny-sdxl-1.0",
18
+ torch_dtype=torch.float16
19
+ )
20
+
21
+ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
22
+ "stabilityai/stable-diffusion-xl-base-1.0",
23
+ controlnet=controlnet,
24
+ #vae=vae,
25
+ torch_dtype=torch.float16,
26
+ variant="fp16",
27
+ use_safetensors=True
28
+ )
29
+ pipe.to("cuda")
30
  generator = torch.Generator(device="cuda")
31
 
32
  #pipe.enable_model_cpu_offload()
 
43
 
44
  if preprocessor == "canny":
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  image = load_image(image_in)
47
 
48
  image = np.array(image)