Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,10 +134,10 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
|
|
| 134 |
)
|
| 135 |
|
| 136 |
if preprocessor == "lineart":
|
| 137 |
-
image = Image.open(image_in)
|
| 138 |
-
image = image.convert("RGB")
|
| 139 |
image = np.array(image)
|
| 140 |
-
image =
|
|
|
|
|
|
|
| 141 |
image = Image.fromarray(image)
|
| 142 |
|
| 143 |
controlnet = ControlNetModel.from_pretrained(
|
|
@@ -162,8 +162,8 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
|
|
| 162 |
controlnet=controlnet,
|
| 163 |
vae=vae,
|
| 164 |
torch_dtype=torch.float16,
|
| 165 |
-
variant="fp16",
|
| 166 |
-
use_safetensors=True
|
| 167 |
)
|
| 168 |
|
| 169 |
pipe.to(device)
|
|
|
|
| 134 |
)
|
| 135 |
|
| 136 |
if preprocessor == "lineart":
|
|
|
|
|
|
|
| 137 |
image = np.array(image)
|
| 138 |
+
image = cv2.Canny(image, 100, 200)
|
| 139 |
+
image = image[:, :, None]
|
| 140 |
+
image = np.concatenate([image, image, image], axis=2)
|
| 141 |
image = Image.fromarray(image)
|
| 142 |
|
| 143 |
controlnet = ControlNetModel.from_pretrained(
|
|
|
|
| 162 |
controlnet=controlnet,
|
| 163 |
vae=vae,
|
| 164 |
torch_dtype=torch.float16,
|
| 165 |
+
#variant="fp16",
|
| 166 |
+
#use_safetensors=True
|
| 167 |
)
|
| 168 |
|
| 169 |
pipe.to(device)
|