Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
fix controlnet img2img not working (#35)
Browse files Browse the repository at this point in the history
Signed-off-by: AnyISalIn <anyisalin@gmail.com>
  • Loading branch information
AnyISalIn authored Aug 24, 2023
1 parent 48e84a4 commit e2e2f71
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extension/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def prepare_mask(
def image_dict_from_any(image) -> Optional[Dict[str, np.ndarray]]:
if image is None:
return None

if isinstance(image, (tuple, list)):
image = {'image': image[0], 'mask': image[1]}
elif not isinstance(image, dict):
Expand All @@ -595,7 +595,10 @@ def image_dict_from_any(image) -> Optional[Dict[str, np.ndarray]]:
if image['image'] is None:
image['mask'] = None
return image


if 'mask' not in image:
image['mask'] = None

if isinstance(image['mask'], str):
if os.path.exists(image['mask']):
image['mask'] = np.array(Image.open(image['mask'])).astype('uint8')
Expand Down

0 comments on commit e2e2f71

Please sign in to comment.