From f9b7b9b7b6a33170b392eec35ba6fd6585fde66a Mon Sep 17 00:00:00 2001 From: brandon Date: Fri, 13 Oct 2023 15:54:12 -0700 Subject: [PATCH] Last bits of lint --- src/groundlight/client.py | 9 ++++++--- src/groundlight/internalapi.py | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index a790736a..fe892e39 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -287,7 +287,8 @@ def ask_confident( confidence_threshold: Optional[float] = None, wait: Optional[float] = None, ) -> ImageQuery: - """Evaluates an image with Groundlight, waiting until an answer above the confidence threshold of the detector is reached or the wait period has passed. + """Evaluates an image with Groundlight waiting until an answer above the confidence threshold + of the detector is reached or the wait period has passed. :param detector: the Detector object, or string id of a detector like `det_12345` :type detector: Detector or str @@ -301,7 +302,8 @@ def ask_confident( converted to JPEG at high quality before sending to service. :type image: str or bytes or Image.Image or BytesIO or BufferedReader or np.ndarray - :param confidence_threshold: The confidence threshold to wait for. If not set, use the detector's confidence threshold. + :param confidence_threshold: The confidence threshold to wait for. + If not set, use the detector's confidence threshold. :type confidence_threshold: float :param wait: How long to wait (in seconds) for a confident answer. @@ -481,7 +483,8 @@ def _wait_for_result( :param image_query: An ImageQuery object to poll :type image_query: ImageQuery or str - :param condition: A callable that takes an ImageQuery and returns True or False whether to keep waiting for a better result. + :param condition: A callable that takes an ImageQuery and returns True or False + whether to keep waiting for a better result. :type condition: Callable :param timeout_sec: The maximum number of seconds to wait. diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index b09d9b2b..a324b444 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -78,7 +78,8 @@ def iq_is_answered(iq: ImageQuery) -> bool: if iq.result.confidence is None: # Human label return True - return iq.result.label > 0.5 + placeholder_confidence = 0.5 + return iq.result.label > placeholder_confidence class InternalApiError(ApiException, RuntimeError):