2222 DatasetItem ,
2323 Segment ,
2424 ModelRun ,
25+ Point ,
2526)
2627from nucleus .constants import ERROR_PAYLOAD
2728
@@ -89,7 +90,7 @@ def test_box_pred_upload(model_run):
8990
9091
9192def test_polygon_pred_upload (model_run ):
92- prediction = PolygonPrediction ( ** TEST_POLYGON_PREDICTIONS [0 ])
93+ prediction = PolygonPrediction . from_json ( TEST_POLYGON_PREDICTIONS [0 ])
9394 response = model_run .predict (annotations = [prediction ])
9495
9596 assert response ["model_run_id" ] == model_run .model_run_id
@@ -189,7 +190,7 @@ def test_box_pred_upload_ignore(model_run):
189190
190191
191192def test_polygon_pred_upload_update (model_run ):
192- prediction = PolygonPrediction ( ** TEST_POLYGON_PREDICTIONS [0 ])
193+ prediction = PolygonPrediction . from_json ( TEST_POLYGON_PREDICTIONS [0 ])
193194 response = model_run .predict (annotations = [prediction ])
194195
195196 assert response ["predictions_processed" ] == 1
@@ -203,7 +204,7 @@ def test_polygon_pred_upload_update(model_run):
203204 "reference_id"
204205 ]
205206
206- prediction_update = PolygonPrediction ( ** prediction_update_params )
207+ prediction_update = PolygonPrediction . from_json ( prediction_update_params )
207208 response = model_run .predict (annotations = [prediction_update ], update = True )
208209
209210 assert response ["predictions_processed" ] == 1
@@ -217,7 +218,7 @@ def test_polygon_pred_upload_update(model_run):
217218
218219
219220def test_polygon_pred_upload_ignore (model_run ):
220- prediction = PolygonPrediction ( ** TEST_POLYGON_PREDICTIONS [0 ])
221+ prediction = PolygonPrediction . from_json ( TEST_POLYGON_PREDICTIONS [0 ])
221222 response = model_run .predict (annotations = [prediction ])
222223
223224 assert response ["predictions_processed" ] == 1
@@ -231,7 +232,7 @@ def test_polygon_pred_upload_ignore(model_run):
231232 "reference_id"
232233 ]
233234
234- prediction_update = PolygonPrediction ( ** prediction_update_params )
235+ prediction_update = PolygonPrediction . from_json ( prediction_update_params )
235236 # Default behavior is ignore.
236237 response = model_run .predict (annotations = [prediction_update ])
237238
@@ -249,7 +250,9 @@ def test_mixed_pred_upload(model_run):
249250 prediction_semseg = SegmentationPrediction .from_json (
250251 TEST_SEGMENTATION_PREDICTIONS [0 ]
251252 )
252- prediction_polygon = PolygonPrediction (** TEST_POLYGON_PREDICTIONS [0 ])
253+ prediction_polygon = PolygonPrediction .from_json (
254+ TEST_POLYGON_PREDICTIONS [0 ]
255+ )
253256 prediction_bbox = BoxPrediction (** TEST_BOX_PREDICTIONS [0 ])
254257 response = model_run .predict (
255258 annotations = [prediction_semseg , prediction_polygon , prediction_bbox ]
@@ -276,7 +279,9 @@ def test_mixed_pred_upload_async(model_run: ModelRun):
276279 prediction_semseg = SegmentationPrediction .from_json (
277280 TEST_SEGMENTATION_PREDICTIONS [0 ]
278281 )
279- prediction_polygon = PolygonPrediction (** TEST_POLYGON_PREDICTIONS [0 ])
282+ prediction_polygon = PolygonPrediction .from_json (
283+ TEST_POLYGON_PREDICTIONS [0 ]
284+ )
280285 prediction_bbox = BoxPrediction (** TEST_BOX_PREDICTIONS [0 ])
281286 job : AsyncJob = model_run .predict (
282287 annotations = [prediction_semseg , prediction_polygon , prediction_bbox ],
@@ -310,7 +315,9 @@ def test_mixed_pred_upload_async_with_error(model_run: ModelRun):
310315 prediction_semseg = SegmentationPrediction .from_json (
311316 TEST_SEGMENTATION_PREDICTIONS [0 ]
312317 )
313- prediction_polygon = PolygonPrediction (** TEST_POLYGON_PREDICTIONS [0 ])
318+ prediction_polygon = PolygonPrediction .from_json (
319+ TEST_POLYGON_PREDICTIONS [0 ]
320+ )
314321 prediction_bbox = BoxPrediction (** TEST_BOX_PREDICTIONS [0 ])
315322 prediction_bbox .reference_id = "fake_garbage"
316323
0 commit comments