Skip to content

Commit dd016c9

Browse files
author
brandon
committed
patch up iq_is_confident
1 parent fffb7ed commit dd016c9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/groundlight/internalapi.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,14 @@ def iq_is_confident(iq: ImageQuery, confidence_threshold: float) -> bool:
6767
The only subtlety here is that currently confidence of None means
6868
human label, which is treated as confident.
6969
"""
70-
if not iq.result or not iq.result.confidence:
71-
return False
72-
return iq.result.confidence >= confidence_threshold # type: ignore
70+
try:
71+
if not iq.result or not iq.result.confidence:
72+
return False
73+
return iq.result.confidence >= confidence_threshold # type: ignore
74+
except Exception as e:
75+
if not iq.result or not iq.result["confidence"]:
76+
return False
77+
return iq.result["confidence"] >= confidence_threshold # type: ignore
7378

7479

7580
def iq_is_answered(iq: ImageQuery) -> bool:

0 commit comments

Comments
 (0)