From 3501a7f04344b9507378af37c5c51960132a1d28 Mon Sep 17 00:00:00 2001 From: Brandon <132288221+brandon-groundlight@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:48:50 -0800 Subject: [PATCH] Revert "Internal function bugfix (#296)" This reverts commit 9d153a403abc49cbfd9258579835d98608b2d1ed. --- pyproject.toml | 2 +- src/groundlight/internalapi.py | 4 ---- test/unit/test_internalapi.py | 14 -------------- 3 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 test/unit/test_internalapi.py diff --git a/pyproject.toml b/pyproject.toml index 4e2eaebb..8bdb11d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ packages = [ {include = "**/*.py", from = "src"}, ] readme = "README.md" -version = "0.21.1" +version = "0.21.0" [tool.poetry.dependencies] # For certifi, use ">=" instead of "^" since it upgrades its "major version" every year, not really following semver diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index bff192cd..18f2f3a7 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -65,8 +65,6 @@ def iq_is_confident(iq: ImageQuery, confidence_threshold: float) -> bool: The only subtlety here is that currently confidence of None means human label, which is treated as confident. """ - if not iq.result: - return False return iq.result.confidence >= confidence_threshold # type: ignore @@ -74,8 +72,6 @@ def iq_is_answered(iq: ImageQuery) -> bool: """Returns True if the image query has a ML or human label. Placeholder and special labels (out of domain) have confidences exactly 0.5 """ - if not iq.result: - return False if (iq.result.source == Source.STILL_PROCESSING) or (iq.result.source is None): # Should never be None return False return True diff --git a/test/unit/test_internalapi.py b/test/unit/test_internalapi.py deleted file mode 100644 index fc207509..00000000 --- a/test/unit/test_internalapi.py +++ /dev/null @@ -1,14 +0,0 @@ -from groundlight import ExperimentalApi -from groundlight.internalapi import iq_is_answered, iq_is_confident - - -def test_iq_is_confident(gl_experimental: ExperimentalApi): - det = gl_experimental.get_or_create_detector("Test", "test_query") - iq = gl_experimental.ask_async(det, image="test/assets/dog.jpeg", wait=10) - assert not iq_is_confident(iq, 0.9) - - -def test_iq_is_answered(gl_experimental: ExperimentalApi): - det = gl_experimental.get_or_create_detector("Test", "test_query") - iq = gl_experimental.ask_async(det, image="test/assets/dog.jpeg", wait=10) - assert not iq_is_answered(iq)