diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 07cb2618..b0a4fe63 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -37,7 +37,7 @@ from supervision.detection.vlm import ( LMM, VLM, from_florence_2, - from_google_gemini, + from_google_gemini_2_0, from_google_gemini_2_5, from_moondream, from_paligemma, @@ -1137,7 +1137,7 @@ class Detections: return cls(xyxy=xyxy, mask=mask, data=data) if vlm == VLM.GOOGLE_GEMINI_2_0 or vlm == VLM.GOOGLE_GEMINI_2_5: - xyxy, class_id, class_name = from_google_gemini(result, **kwargs) + xyxy, class_id, class_name = from_google_gemini_2_0(result, **kwargs) data = {CLASS_NAME_DATA_FIELD: class_name} return cls(xyxy=xyxy, class_id=class_id, data=data) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 4be54be5..a9f6e781 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -330,7 +330,7 @@ def from_florence_2( assert False, f"Unimplemented task: {task}" -def from_google_gemini( +def from_google_gemini_2_0( result: str, resolution_wh: Tuple[int, int], classes: Optional[List[str]] = None, diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 4d21493b..f40b6f83 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -143,12 +143,18 @@ def validate_keypoints_fields( def validate_resolution(resolution: Any) -> Tuple[int, int]: if not (isinstance(resolution, tuple) and len(resolution) == 2): raise ValueError( - f"resolution must be a tuple of two integers, got {type(resolution)} with value {resolution}" + f""" + resolution must be a tuple of two integers, got + {type(resolution)} with value {resolution} + """ ) w, h = resolution if not (isinstance(w, int) and isinstance(h, int)): raise ValueError( - f"Both elements in resolution must be integers. Got types ({type(w)}, {type(h)})" + f""" + Both elements in resolution must be integers. + Got types ({type(w)}, {type(h)}) + """ ) if w <= 0 or h <= 0: raise ValueError( diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index 7b9acb0c..c2762f5d 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -7,7 +7,7 @@ import pytest from supervision.detection.vlm import ( from_florence_2, - from_google_gemini, + from_google_gemini_2_0, from_moondream, from_paligemma, from_qwen_2_5_vl, @@ -492,7 +492,7 @@ def test_from_google_gemini( expected_results: Tuple[np.ndarray, Optional[np.ndarray], np.ndarray], ) -> None: with exception: - xyxy, class_id, class_name = from_google_gemini( + xyxy, class_id, class_name = from_google_gemini_2_0( result=result, resolution_wh=resolution_wh, classes=classes ) if expected_results is not None: