Skip to content

Commit 29f64cf

Browse files
authored
Fix bug in wait_for_confident_result (#317)
The `confidence_threshold` parameter defaults to `None`, and the docstring states that if it is `None` then the detector's confidence threshold will be used. However, it currently only fetches the detector's confidence threshold if the value for `image_query` is a string - if you pass it an `ImageQuery` object, `confidence_threshold` will still be `None` when passed to `iq_is_confident`, which will then error when trying to do `iq.result.confidence >= confidence_threshold`. This fixes it so it will always fetch the detector's confidence threshold if the inputted `confidence_threshold` is None.
1 parent 81e1e09 commit 29f64cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/groundlight/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,8 @@ def wait_for_confident_result(
10041004
"""
10051005
if isinstance(image_query, str):
10061006
image_query = self.get_image_query(image_query)
1007+
1008+
if confidence_threshold is None:
10071009
confidence_threshold = self.get_detector(image_query.detector_id).confidence_threshold
10081010

10091011
confidence_above_thresh = partial(iq_is_confident, confidence_threshold=confidence_threshold) # type: ignore

0 commit comments

Comments
 (0)