File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ import time
12from datetime import datetime
23
34import pytest
@@ -106,6 +107,25 @@ def test_counting_detector(gl_experimental: ExperimentalApi):
106107 assert count_iq .result .count is not None
107108
108109
110+ def test_counting_detector_async (gl_experimental : ExperimentalApi ):
111+ """
112+ verify that we can create and submit to a counting detector
113+ """
114+ name = f"Test { datetime .utcnow ()} "
115+ created_detector = gl_experimental .create_counting_detector (name , "How many dogs" , "dog" )
116+ assert created_detector is not None
117+ async_iq = gl_experimental .ask_async (created_detector , "test/assets/dog.jpeg" )
118+ # attempting to access fields within the result should raise an exception
119+ with pytest .raises (AttributeError ):
120+ _ = async_iq .result .label # type: ignore
121+ with pytest .raises (AttributeError ):
122+ _ = async_iq .result .confidence # type: ignore
123+ time .sleep (5 )
124+ # you should be able to get a "real" result by retrieving an updated image query object from the server
125+ _image_query = gl_experimental .get_image_query (id = async_iq .id )
126+ assert _image_query .result is not None
127+
128+
109129@pytest .mark .skip (
110130 reason = (
111131 "General users currently currently can't use multiclass detectors. If you have questions, reach out"
You can’t perform that action at this time.
0 commit comments