@@ -66,19 +66,13 @@ def test_update_detector_escalation_type(gl_experimental: ExperimentalApi):
66
66
updated_detector .escalation_type == "STANDARD"
67
67
68
68
69
- @pytest .mark .skip (
70
- reason = (
71
- "Users currently don't have permission to turn object detection on their own. If you have questions, reach out"
72
- " to Groundlight support."
73
- )
74
- )
75
- def test_submit_roi (gl_experimental : ExperimentalApi , image_query_yes : ImageQuery ):
69
+ def test_submit_roi (gl_experimental : ExperimentalApi , image_query_one : ImageQuery ):
76
70
"""
77
71
verify that we can submit an ROI
78
72
"""
79
73
label_name = "dog"
80
74
roi = gl_experimental .create_roi (label_name , (0 , 0 ), (0.5 , 0.5 ))
81
- gl_experimental .add_label (image_query_yes .id , "YES" , [roi ])
75
+ gl_experimental .add_label (image_query_one .id , 1 , [roi ])
82
76
83
77
84
78
@pytest .mark .skip (
@@ -87,21 +81,21 @@ def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuer
87
81
" to Groundlight support."
88
82
)
89
83
)
90
- def test_submit_multiple_rois (gl_experimental : ExperimentalApi , image_query_no : ImageQuery ):
84
+ def test_submit_multiple_rois (gl_experimental : ExperimentalApi , image_query_one : ImageQuery ):
91
85
"""
92
86
verify that we can submit multiple ROIs
93
87
"""
94
88
label_name = "dog"
95
89
roi = gl_experimental .create_roi (label_name , (0 , 0 ), (0.5 , 0.5 ))
96
- gl_experimental .add_label (image_query_no , "YES" , [roi ] * 3 )
90
+ gl_experimental .add_label (image_query_one , 3 , [roi ] * 3 )
97
91
98
92
99
93
def test_counting_detector (gl_experimental : ExperimentalApi ):
100
94
"""
101
95
verify that we can create and submit to a counting detector
102
96
"""
103
97
name = f"Test { datetime .utcnow ()} "
104
- created_detector = gl_experimental .create_counting_detector (name , "How many dogs" , "dog" )
98
+ created_detector = gl_experimental .create_counting_detector (name , "How many dogs" , "dog" , confidence_threshold = 0.0 )
105
99
assert created_detector is not None
106
100
count_iq = gl_experimental .submit_image_query (created_detector , "test/assets/dog.jpeg" )
107
101
assert count_iq .result .count is not None
@@ -112,7 +106,7 @@ def test_counting_detector_async(gl_experimental: ExperimentalApi):
112
106
verify that we can create and submit to a counting detector
113
107
"""
114
108
name = f"Test { datetime .utcnow ()} "
115
- created_detector = gl_experimental .create_counting_detector (name , "How many dogs" , "dog" )
109
+ created_detector = gl_experimental .create_counting_detector (name , "How many dogs" , "dog" , confidence_threshold = 0.0 )
116
110
assert created_detector is not None
117
111
async_iq = gl_experimental .ask_async (created_detector , "test/assets/dog.jpeg" )
118
112
# attempting to access fields within the result should raise an exception
@@ -126,27 +120,34 @@ def test_counting_detector_async(gl_experimental: ExperimentalApi):
126
120
assert _image_query .result is not None
127
121
128
122
129
- @pytest .mark .skip (
130
- reason = (
131
- "General users currently currently can't use multiclass detectors. If you have questions, reach out"
132
- " to Groundlight support, or upgrade your plan."
133
- )
134
- )
135
123
def test_multiclass_detector (gl_experimental : ExperimentalApi ):
136
124
"""
137
125
verify that we can create and submit to a multi-class detector
138
126
"""
139
127
name = f"Test { datetime .utcnow ()} "
140
128
class_names = ["Golden Retriever" , "Labrador Retriever" , "Poodle" ]
141
129
created_detector = gl_experimental .create_multiclass_detector (
142
- name , "What kind of dog is this?" , class_names = class_names
130
+ name , "What kind of dog is this?" , class_names = class_names , confidence_threshold = 0.0
143
131
)
144
132
assert created_detector is not None
145
133
mc_iq = gl_experimental .submit_image_query (created_detector , "test/assets/dog.jpeg" )
146
134
assert mc_iq .result .label is not None
147
135
assert mc_iq .result .label in class_names
148
136
149
137
138
+ def test_text_recognition_detector (gl_experimental : ExperimentalApi ):
139
+ """
140
+ verify that we can create and submit to a text recognition detector
141
+ """
142
+ name = f"Test { datetime .utcnow ()} "
143
+ created_detector = gl_experimental .create_text_recognition_detector (
144
+ name , "What is the date and time?" , confidence_threshold = 0.0
145
+ )
146
+ assert created_detector is not None
147
+ mc_iq = gl_experimental .submit_image_query (created_detector , "test/assets/dog.jpeg" )
148
+ assert mc_iq .result .text is not None
149
+
150
+
150
151
@pytest .mark .skip (
151
152
reason = (
152
153
"General users currently currently can't use bounding box detectors. If you have questions, reach out"
@@ -159,7 +160,7 @@ def test_bounding_box_detector(gl_experimental: ExperimentalApi):
159
160
"""
160
161
name = f"Test { datetime .now (timezone .utc )} "
161
162
created_detector = gl_experimental .create_bounding_box_detector (
162
- name , "Draw a bounding box around each dog in the image" , "dog"
163
+ name , "Draw a bounding box around each dog in the image" , "dog" , confidence_threshold = 0.0
163
164
)
164
165
assert created_detector is not None
165
166
bbox_iq = gl_experimental .submit_image_query (created_detector , "test/assets/dog.jpeg" )
@@ -179,7 +180,7 @@ def test_bounding_box_detector_async(gl_experimental: ExperimentalApi):
179
180
"""
180
181
name = f"Test { datetime .now (timezone .utc )} "
181
182
created_detector = gl_experimental .create_bounding_box_detector (
182
- name , "Draw a bounding box around each dog in the image" , "dog"
183
+ name , "Draw a bounding box around each dog in the image" , "dog" , confidence_threshold = 0.0
183
184
)
184
185
assert created_detector is not None
185
186
async_iq = gl_experimental .ask_async (created_detector , "test/assets/dog.jpeg" )
0 commit comments