jhj0517 commited on
Commit
a7f9f59
1 Parent(s): 3423be2

Update return value

Browse files
Files changed (1) hide show
  1. modules/utils.py +2 -2
modules/utils.py CHANGED
@@ -29,7 +29,7 @@ def save_image(image: Union[np.ndarray, str],
29
  output_dir: Optional[str] = None):
30
 
31
  if output_dir is None and output_path is None:
32
- raise "Either output_path or output_dir should be provided"
33
 
34
  if isinstance(image, str):
35
  image = Image.open(image)
@@ -38,7 +38,7 @@ def save_image(image: Union[np.ndarray, str],
38
 
39
  if output_path is not None:
40
  image.save(output_path, "JPEG")
41
- return
42
 
43
  os.makedirs(output_dir, exist_ok=True)
44
  num_images = len(get_image_files(output_dir))
 
29
  output_dir: Optional[str] = None):
30
 
31
  if output_dir is None and output_path is None:
32
+ raise ValueError("Either output_path or output_dir should be provided")
33
 
34
  if isinstance(image, str):
35
  image = Image.open(image)
 
38
 
39
  if output_path is not None:
40
  image.save(output_path, "JPEG")
41
+ return output_path
42
 
43
  os.makedirs(output_dir, exist_ok=True)
44
  num_images = len(get_image_files(output_dir))