@@ -67,24 +67,25 @@ def create_data_row(self, **kwargs):
6767
6868 return self .client ._create (DataRow , kwargs )
6969
70- def create_data_rows (self , items , tiled_imagery = False ):
70+ def create_data_rows (self , items ):
7171 """ Creates multiple DataRow objects based on the given `items`.
7272
7373 Each element in `items` can be either a `str` or a `dict`. If
7474 it is a `str`, then it is interpreted as a local file path. The file
7575 is uploaded to Labelbox and a DataRow referencing it is created.
76- If an item is a `dict`, then it should map `DataRow` fields (or their
77- names) to values. At the minimum an `item` passed as a `dict` must
78- contain a `DataRow.row_data` key and value.
7976
77+ If an item is a `dict`, then it could support one of the two following structures
78+ 1. For static imagery, video, and text it should map `DataRow` fields (or their names) to values.
79+ At the minimum an `item` passed as a `dict` must contain a `DataRow.row_data` key and value.
80+ 2. For tiled imagery the dict must match the import structure specified in the link below
81+ https://docs.labelbox.com/data-model/en/index-en#tiled-imagery-import
82+
8083 >>> dataset.create_data_rows([
8184 >>> {DataRow.row_data:"http://my_site.com/photos/img_01.jpg"},
82- >>> "path/to/file2.jpg"
85+ >>> "path/to/file2.jpg",
86+ >>> {tileLayerUrl : "http://", ...}
8387 >>> ])
8488
85- If tiled_imagery = True, See the link below for supported fields:
86- https://docs.labelbox.com/data-model/en/index-en#tiled-imagery-import
87-
8889 For an example showing how to upload tiled data_rows see the following notebook:
8990 https://github.com/Labelbox/labelbox-python/blob/ms/develop/model_assisted_labeling/tiled_imagery_mal.ipynb
9091
@@ -120,6 +121,9 @@ def upload_if_necessary(item):
120121 items = thread_pool .map (upload_if_necessary , items )
121122
122123 def convert_item (item ):
124+ # Don't make any changes to tms data
125+ if "tileLayerUrl" in item :
126+ return item
123127 # Convert string names to fields.
124128 item = {
125129 key if isinstance (key , Field ) else DataRow .field (key ): value
@@ -142,9 +146,7 @@ def convert_item(item):
142146 }
143147
144148 # Prepare and upload the desciptor file
145- if not tiled_imagery :
146- items = [convert_item (item ) for item in items ]
147-
149+ items = [convert_item (item ) for item in items ]
148150 data = json .dumps (items )
149151 descriptor_url = self .client .upload_data (data )
150152
0 commit comments