Spaces:
Paused
Paused
alessandro trinca tornidor
commited on
Commit
·
71ce930
1
Parent(s):
024790f
tests: fix broken test case because of missing pathlib import
Browse files
lisa_on_cuda/utils/app_helpers.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import argparse
|
2 |
import logging
|
|
|
3 |
import os
|
4 |
import re
|
5 |
from typing import Callable
|
@@ -315,7 +316,7 @@ def get_inference_model_by_args(
|
|
315 |
|
316 |
def inference(
|
317 |
input_str: str,
|
318 |
-
input_image: str | np.ndarray,
|
319 |
internal_logger: logging = None,
|
320 |
embedding_key: str = None
|
321 |
):
|
@@ -357,8 +358,8 @@ def get_inference_model_by_args(
|
|
357 |
|
358 |
internal_logger.info("read and preprocess image.")
|
359 |
image_np = input_image
|
360 |
-
if isinstance(input_image, str):
|
361 |
-
image_np = cv2.imread(input_image)
|
362 |
image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
|
363 |
original_size_list = [image_np.shape[:2]]
|
364 |
internal_logger.debug("start clip_image_processor.preprocess")
|
|
|
1 |
import argparse
|
2 |
import logging
|
3 |
+
from pathlib import Path
|
4 |
import os
|
5 |
import re
|
6 |
from typing import Callable
|
|
|
316 |
|
317 |
def inference(
|
318 |
input_str: str,
|
319 |
+
input_image: str | Path | np.ndarray,
|
320 |
internal_logger: logging = None,
|
321 |
embedding_key: str = None
|
322 |
):
|
|
|
358 |
|
359 |
internal_logger.info("read and preprocess image.")
|
360 |
image_np = input_image
|
361 |
+
if isinstance(input_image, str) or isinstance(input_image, Path):
|
362 |
+
image_np = cv2.imread(str(input_image))
|
363 |
image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
|
364 |
original_size_list = [image_np.shape[:2]]
|
365 |
internal_logger.debug("start clip_image_processor.preprocess")
|
poetry.lock
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
tests/imgs/{example1_mask_0.png → example0_mask_0.png}
RENAMED
File without changes
|
tests/imgs/{example1_mask_0_broken.png → example0_mask_0_broken.png}
RENAMED
File without changes
|
tests/test_app_helpers.py
CHANGED
@@ -87,3 +87,7 @@ class TestAppBuilders(unittest.TestCase):
|
|
87 |
logging.info(f"Written files with prefix '{prefix}' in {output_folder} folder.")
|
88 |
raise ae
|
89 |
logging.info("end")
|
|
|
|
|
|
|
|
|
|
87 |
logging.info(f"Written files with prefix '{prefix}' in {output_folder} folder.")
|
88 |
raise ae
|
89 |
logging.info("end")
|
90 |
+
|
91 |
+
|
92 |
+
if __name__ == '__main__':
|
93 |
+
unittest.main()
|