@@ -52,13 +52,13 @@ def fixture_detector(gl: Groundlight) -> Detector:
5252
5353@pytest .fixture (name = "image_query_yes" )
5454def fixture_image_query_yes (gl : Groundlight , detector : Detector ) -> ImageQuery :
55- iq = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" )
55+ iq = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , human_review = "NEVER" )
5656 return iq
5757
5858
5959@pytest .fixture (name = "image_query_no" )
6060def fixture_image_query_no (gl : Groundlight , detector : Detector ) -> ImageQuery :
61- iq = gl .submit_image_query (detector = detector .id , image = "test/assets/cat.jpeg" )
61+ iq = gl .submit_image_query (detector = detector .id , image = "test/assets/cat.jpeg" , human_review = "NEVER" )
6262 return iq
6363
6464
@@ -184,23 +184,31 @@ def validate_image_query(_image_query: ImageQuery):
184184 assert isinstance (_image_query , ImageQuery )
185185 assert is_valid_display_result (_image_query .result )
186186
187- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 )
187+ _image_query = gl .submit_image_query (
188+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 , human_review = "NEVER"
189+ )
188190 validate_image_query (_image_query )
189- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , wait = 3 )
191+ _image_query = gl .submit_image_query (
192+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 3 , human_review = "NEVER"
193+ )
190194 validate_image_query (_image_query )
191- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 , patience_time = 20 )
195+ _image_query = gl .submit_image_query (
196+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 , patience_time = 20 , human_review = "NEVER"
197+ )
192198 validate_image_query (_image_query )
193199 _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , human_review = "NEVER" )
194200 validate_image_query (_image_query )
195201 _image_query = gl .submit_image_query (
196- detector = detector .id , image = "test/assets/dog.jpeg" , wait = 180 , confidence_threshold = 0.75
202+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 180 , confidence_threshold = 0.75 , human_review = "NEVER"
197203 )
198204 validate_image_query (_image_query )
199205 assert _image_query .result .confidence >= IQ_IMPROVEMENT_THRESHOLD
200206
201207
202208def test_submit_image_query_blocking (gl : Groundlight , detector : Detector ):
203- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 )
209+ _image_query = gl .submit_image_query (
210+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 , human_review = "NEVER"
211+ )
204212 assert str (_image_query )
205213 assert isinstance (_image_query , ImageQuery )
206214 assert is_valid_display_result (_image_query .result )
@@ -209,19 +217,19 @@ def test_submit_image_query_blocking(gl: Groundlight, detector: Detector):
209217def test_submit_image_query_returns_yes (gl : Groundlight ):
210218 # We use the "never-review" pipeline to guarantee a confident "yes" answer.
211219 detector = gl .get_or_create_detector (name = "Always a dog" , query = "Is there a dog?" , pipeline_config = "never-review" )
212- image_query = gl .submit_image_query (detector = detector , image = "test/assets/dog.jpeg" , wait = 10 )
220+ image_query = gl .submit_image_query (detector = detector , image = "test/assets/dog.jpeg" , wait = 10 , human_review = "NEVER" )
213221 assert image_query .result .label == Label .YES
214222
215223
216224def test_submit_image_query_filename (gl : Groundlight , detector : Detector ):
217- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" )
225+ _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , human_review = "NEVER" )
218226 assert str (_image_query )
219227 assert isinstance (_image_query , ImageQuery )
220228 assert is_valid_display_result (_image_query .result )
221229
222230
223231def test_submit_image_query_png (gl : Groundlight , detector : Detector ):
224- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/cat.png" )
232+ _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/cat.png" , human_review = "NEVER" )
225233 assert str (_image_query )
226234 assert isinstance (_image_query , ImageQuery )
227235 assert is_valid_display_result (_image_query .result )
@@ -240,7 +248,7 @@ def test_submit_image_query_with_human_review_param(gl: Groundlight, detector: D
240248
241249def test_submit_image_query_jpeg_bytes (gl : Groundlight , detector : Detector ):
242250 jpeg = open ("test/assets/dog.jpeg" , "rb" ).read ()
243- _image_query = gl .submit_image_query (detector = detector .id , image = jpeg )
251+ _image_query = gl .submit_image_query (detector = detector .id , image = jpeg , human_review = "NEVER" )
244252 assert str (_image_query )
245253 assert isinstance (_image_query , ImageQuery )
246254 assert is_valid_display_result (_image_query .result )
@@ -252,19 +260,21 @@ def test_submit_image_query_jpeg_truncated(gl: Groundlight, detector: Detector):
252260 # This is an extra difficult test because the header is valid.
253261 # So a casual check of the image will appear valid.
254262 with pytest .raises (openapi_client .exceptions .ApiException ) as exc_info :
255- _image_query = gl .submit_image_query (detector = detector .id , image = jpeg_truncated )
263+ _image_query = gl .submit_image_query (detector = detector .id , image = jpeg_truncated , human_review = "NEVER" )
256264 exc_value = exc_info .value
257265 assert is_user_error (exc_value .status )
258266
259267
260268def test_submit_image_query_bad_filename (gl : Groundlight , detector : Detector ):
261269 with pytest .raises (FileNotFoundError ):
262- _image_query = gl .submit_image_query (detector = detector .id , image = "missing-file.jpeg" )
270+ _image_query = gl .submit_image_query (detector = detector .id , image = "missing-file.jpeg" , human_review = "NEVER" )
263271
264272
265273def test_submit_image_query_bad_jpeg_file (gl : Groundlight , detector : Detector ):
266274 with pytest .raises (ValueError ) as exc_info :
267- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/blankfile.jpeg" )
275+ _image_query = gl .submit_image_query (
276+ detector = detector .id , image = "test/assets/blankfile.jpeg" , human_review = "NEVER"
277+ )
268278 assert "jpeg" in str (exc_info ).lower ()
269279
270280
@@ -274,10 +284,10 @@ def test_submit_image_query_pil(gl: Groundlight, detector: Detector):
274284 from PIL import Image
275285
276286 dog = Image .open ("test/assets/dog.jpeg" )
277- _image_query = gl .submit_image_query (detector = detector .id , image = dog )
287+ _image_query = gl .submit_image_query (detector = detector .id , image = dog , human_review = "NEVER" )
278288
279289 black = Image .new ("RGB" , (640 , 480 ))
280- _image_query = gl .submit_image_query (detector = detector .id , image = black )
290+ _image_query = gl .submit_image_query (detector = detector .id , image = black , human_review = "NEVER" )
281291
282292
283293def test_submit_image_query_wait_and_want_async_causes_exception (gl : Groundlight , detector : Detector ):
@@ -287,7 +297,7 @@ def test_submit_image_query_wait_and_want_async_causes_exception(gl: Groundlight
287297
288298 with pytest .raises (ValueError ):
289299 _image_query = gl .submit_image_query (
290- detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 , want_async = True
300+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 10 , want_async = True , human_review = "NEVER"
291301 )
292302
293303
@@ -296,7 +306,9 @@ def test_submit_image_query_with_want_async_workflow(gl: Groundlight, detector:
296306 Tests the workflow for submitting an image query with the want_async parameter set to True.
297307 """
298308
299- _image_query = gl .submit_image_query (detector = detector .id , image = "test/assets/dog.jpeg" , wait = 0 , want_async = True )
309+ _image_query = gl .submit_image_query (
310+ detector = detector .id , image = "test/assets/dog.jpeg" , wait = 0 , want_async = True , human_review = "NEVER"
311+ )
300312
301313 # the result should be None
302314 assert _image_query .result is None
@@ -450,7 +462,7 @@ def test_enum_string_equality():
450462@pytest .mark .skipif (MISSING_NUMPY or MISSING_PIL , reason = "Needs numpy and pillow" ) # type: ignore
451463def test_submit_numpy_image (gl : Groundlight , detector : Detector ):
452464 np_img = np .random .uniform (0 , 255 , (600 , 800 , 3 )) # type: ignore
453- _image_query = gl .submit_image_query (detector = detector .id , image = np_img )
465+ _image_query = gl .submit_image_query (detector = detector .id , image = np_img , human_review = "NEVER" )
454466 assert str (_image_query )
455467 assert isinstance (_image_query , ImageQuery )
456468 assert is_valid_display_result (_image_query .result )
@@ -481,7 +493,7 @@ def submit_noisy_image(image, label=None):
481493 noisy_image = contrast .enhance (random .uniform (0.75 , 1 ))
482494 brightness = ImageEnhance .Brightness (noisy_image )
483495 noisy_image = brightness .enhance (random .uniform (0.75 , 1 ))
484- img_query = gl .submit_image_query (detector = detector .id , image = noisy_image , wait = 0 )
496+ img_query = gl .submit_image_query (detector = detector .id , image = noisy_image , wait = 0 , human_review = "NEVER" )
485497 if label is not None :
486498 gl .add_label (img_query , label )
487499 return img_query
0 commit comments