22
22
DatasetItem ,
23
23
Segment ,
24
24
ModelRun ,
25
+ Point ,
25
26
)
26
27
from nucleus .constants import ERROR_PAYLOAD
27
28
@@ -89,7 +90,7 @@ def test_box_pred_upload(model_run):
89
90
90
91
91
92
def test_polygon_pred_upload (model_run ):
92
- prediction = PolygonPrediction ( ** TEST_POLYGON_PREDICTIONS [0 ])
93
+ prediction = PolygonPrediction . from_json ( TEST_POLYGON_PREDICTIONS [0 ])
93
94
response = model_run .predict (annotations = [prediction ])
94
95
95
96
assert response ["model_run_id" ] == model_run .model_run_id
@@ -189,7 +190,7 @@ def test_box_pred_upload_ignore(model_run):
189
190
190
191
191
192
def test_polygon_pred_upload_update (model_run ):
192
- prediction = PolygonPrediction ( ** TEST_POLYGON_PREDICTIONS [0 ])
193
+ prediction = PolygonPrediction . from_json ( TEST_POLYGON_PREDICTIONS [0 ])
193
194
response = model_run .predict (annotations = [prediction ])
194
195
195
196
assert response ["predictions_processed" ] == 1
@@ -203,7 +204,7 @@ def test_polygon_pred_upload_update(model_run):
203
204
"reference_id"
204
205
]
205
206
206
- prediction_update = PolygonPrediction ( ** prediction_update_params )
207
+ prediction_update = PolygonPrediction . from_json ( prediction_update_params )
207
208
response = model_run .predict (annotations = [prediction_update ], update = True )
208
209
209
210
assert response ["predictions_processed" ] == 1
@@ -217,7 +218,7 @@ def test_polygon_pred_upload_update(model_run):
217
218
218
219
219
220
def test_polygon_pred_upload_ignore (model_run ):
220
- prediction = PolygonPrediction ( ** TEST_POLYGON_PREDICTIONS [0 ])
221
+ prediction = PolygonPrediction . from_json ( TEST_POLYGON_PREDICTIONS [0 ])
221
222
response = model_run .predict (annotations = [prediction ])
222
223
223
224
assert response ["predictions_processed" ] == 1
@@ -231,7 +232,7 @@ def test_polygon_pred_upload_ignore(model_run):
231
232
"reference_id"
232
233
]
233
234
234
- prediction_update = PolygonPrediction ( ** prediction_update_params )
235
+ prediction_update = PolygonPrediction . from_json ( prediction_update_params )
235
236
# Default behavior is ignore.
236
237
response = model_run .predict (annotations = [prediction_update ])
237
238
@@ -249,7 +250,9 @@ def test_mixed_pred_upload(model_run):
249
250
prediction_semseg = SegmentationPrediction .from_json (
250
251
TEST_SEGMENTATION_PREDICTIONS [0 ]
251
252
)
252
- prediction_polygon = PolygonPrediction (** TEST_POLYGON_PREDICTIONS [0 ])
253
+ prediction_polygon = PolygonPrediction .from_json (
254
+ TEST_POLYGON_PREDICTIONS [0 ]
255
+ )
253
256
prediction_bbox = BoxPrediction (** TEST_BOX_PREDICTIONS [0 ])
254
257
response = model_run .predict (
255
258
annotations = [prediction_semseg , prediction_polygon , prediction_bbox ]
@@ -276,7 +279,9 @@ def test_mixed_pred_upload_async(model_run: ModelRun):
276
279
prediction_semseg = SegmentationPrediction .from_json (
277
280
TEST_SEGMENTATION_PREDICTIONS [0 ]
278
281
)
279
- prediction_polygon = PolygonPrediction (** TEST_POLYGON_PREDICTIONS [0 ])
282
+ prediction_polygon = PolygonPrediction .from_json (
283
+ TEST_POLYGON_PREDICTIONS [0 ]
284
+ )
280
285
prediction_bbox = BoxPrediction (** TEST_BOX_PREDICTIONS [0 ])
281
286
job : AsyncJob = model_run .predict (
282
287
annotations = [prediction_semseg , prediction_polygon , prediction_bbox ],
@@ -310,7 +315,9 @@ def test_mixed_pred_upload_async_with_error(model_run: ModelRun):
310
315
prediction_semseg = SegmentationPrediction .from_json (
311
316
TEST_SEGMENTATION_PREDICTIONS [0 ]
312
317
)
313
- prediction_polygon = PolygonPrediction (** TEST_POLYGON_PREDICTIONS [0 ])
318
+ prediction_polygon = PolygonPrediction .from_json (
319
+ TEST_POLYGON_PREDICTIONS [0 ]
320
+ )
314
321
prediction_bbox = BoxPrediction (** TEST_BOX_PREDICTIONS [0 ])
315
322
prediction_bbox .reference_id = "fake_garbage"
316
323
0 commit comments