linoyts HF staff commited on
Commit
dee21e3
1 Parent(s): 2a4a91e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -15,7 +15,7 @@ from controlnet_aux import PidiNetDetector, HEDdetector
15
  from diffusers.utils import load_image
16
  from huggingface_hub import HfApi
17
  from pathlib import Path
18
- from PIL import Image
19
  import torch
20
  import numpy as np
21
  import cv2
@@ -178,7 +178,7 @@ def run(
178
  width, height = image['composite'].size
179
  ratio = np.sqrt(1024. * 1024. / (width * height))
180
  new_width, new_height = int(width * ratio), int(height * ratio)
181
- image = image['composite'].resize((new_width, new_height))
182
 
183
  if not use_hed:
184
  controlnet_img = image
 
15
  from diffusers.utils import load_image
16
  from huggingface_hub import HfApi
17
  from pathlib import Path
18
+ from PIL import Image, ImageOps
19
  import torch
20
  import numpy as np
21
  import cv2
 
178
  width, height = image['composite'].size
179
  ratio = np.sqrt(1024. * 1024. / (width * height))
180
  new_width, new_height = int(width * ratio), int(height * ratio)
181
+ image = ImageOps.invert(image['composite']).resize((new_width, new_height))
182
 
183
  if not use_hed:
184
  controlnet_img = image