fffiloni commited on
Commit
3d0321b
1 Parent(s): 84e4bdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -29,6 +29,11 @@ controlnet = ControlNetModel.from_pretrained(
29
  torch_dtype=torch.float16
30
  )
31
 
 
 
 
 
 
32
  def check_use_custom_or_no(value):
33
  if value is True:
34
  return gr.update(visible=True)
@@ -111,7 +116,7 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
111
 
112
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
113
  "stabilityai/stable-diffusion-xl-base-1.0",
114
- controlnet=controlnet,
115
  vae=vae,
116
  torch_dtype=torch.float16,
117
  variant="fp16",
@@ -142,6 +147,8 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
142
  image = image[:, :, None]
143
  image = np.concatenate([image, image, image], axis=2)
144
  image = Image.fromarray(image)
 
 
145
 
146
  if use_custom_model:
147
 
 
29
  torch_dtype=torch.float16
30
  )
31
 
32
+ controlnet_lineart = ControlNetModel.from_poretrained(
33
+ "lllyasviel/control_v11p_sd15_lineart",
34
+ torch_dtype=torch.float16
35
+ )
36
+
37
  def check_use_custom_or_no(value):
38
  if value is True:
39
  return gr.update(visible=True)
 
116
 
117
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
118
  "stabilityai/stable-diffusion-xl-base-1.0",
119
+ controlnet=controlnet_lineart,
120
  vae=vae,
121
  torch_dtype=torch.float16,
122
  variant="fp16",
 
147
  image = image[:, :, None]
148
  image = np.concatenate([image, image, image], axis=2)
149
  image = Image.fromarray(image)
150
+ elif preprocessor == "lineart":
151
+ image = PIL.Image.fromarray(image_in)
152
 
153
  if use_custom_model:
154