File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 2
2
from nucleus .dataset_item import DatasetItem
3
3
from nucleus .annotation import Annotation
4
4
from nucleus .utils import format_dataset_item_response
5
+ from nucleus .job import AsyncJob
5
6
6
7
from .constants import DEFAULT_ANNOTATION_UPDATE_MODE
7
8
@@ -146,9 +147,10 @@ def annotate(
146
147
)
147
148
148
149
def send_to_labeling (self , project_id : str ):
149
- return self ._client .make_request (
150
+ response = self ._client .make_request (
150
151
{}, f"slice/{ self .slice_id } /{ project_id } /send_to_labeling"
151
152
)
153
+ return AsyncJob (response ["job_id" ], self ._client )
152
154
153
155
154
156
def check_annotations_are_in_slice (
Original file line number Diff line number Diff line change 10
10
TEST_MODEL_RUN = "[PyTest] Test Model Run"
11
11
TEST_DATASET_NAME = "[PyTest] Test Dataset"
12
12
TEST_SLICE_NAME = "[PyTest] Test Slice"
13
+ TEST_PROJECT_ID = "60b699d70f139e002dd31bfc"
13
14
14
15
15
16
TEST_IMG_URLS = [
Original file line number Diff line number Diff line change 6
6
TEST_IMG_URLS ,
7
7
TEST_SLICE_NAME ,
8
8
TEST_BOX_ANNOTATIONS ,
9
+ TEST_PROJECT_ID ,
9
10
reference_id_from_url ,
10
11
)
12
+ from nucleus .job import AsyncJob
11
13
12
14
13
15
@pytest .fixture ()
@@ -141,3 +143,29 @@ def sort_by_reference_id(items):
141
143
assert sort_by_reference_id (all_stored_items ) == sort_by_reference_id (
142
144
ds_items [:3 ]
143
145
)
146
+
147
+
148
+ def test_slice_send_to_labeling (dataset ):
149
+ # Dataset upload
150
+ ds_items = []
151
+ for url in TEST_IMG_URLS :
152
+ ds_items .append (
153
+ DatasetItem (
154
+ image_location = url ,
155
+ reference_id = reference_id_from_url (url ),
156
+ )
157
+ )
158
+ response = dataset .append (ds_items )
159
+ assert ERROR_PAYLOAD not in response .json ()
160
+
161
+ # Slice creation
162
+ slc = dataset .create_slice (
163
+ name = TEST_SLICE_NAME ,
164
+ reference_ids = [ds_items [0 ].reference_id , ds_items [1 ].reference_id ],
165
+ )
166
+
167
+ response = slc .info ()
168
+ assert len (response ["dataset_items" ]) == 2
169
+
170
+ response = slc .send_to_labeling (TEST_PROJECT_ID )
171
+ assert isinstance (response , AsyncJob )
You can’t perform that action at this time.
0 commit comments