fix: 🐞 rename from_google_gemini to from_google_gemini_2_0 keep names consistent

This commit is contained in:
Onuralp SEZER 2025-07-14 14:24:37 +03:00
parent 5d866fd8a1
commit 4ed667da88
No known key found for this signature in database
GPG Key ID: CF0835DFDF14CA38
4 changed files with 13 additions and 7 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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(

View File

@ -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: