1
1
from labelbox import Client as labelboxClient
2
2
from labelbox .schema .dataset import Dataset as labelboxDataset
3
3
from labelbase .metadata import sync_metadata_fields
4
- from labelbase . uploader import batch_create_data_rows , batch_upload_annotations , batch_rows_to_project
4
+ from labelbase import uploader
5
5
import pandas as pd
6
6
from labelpandas import connector
7
7
@@ -101,18 +101,27 @@ def create_data_rows_from_table(
101
101
return {"upload_results" : [], "conversion_errors" : errors }
102
102
103
103
# Upload your data rows to Labelbox
104
- data_row_upload_results = batch_create_data_rows (
104
+ data_row_upload_results = uploader . batch_create_data_rows (
105
105
client = self .lb_client , dataset = lb_dataset , global_key_to_upload_dict = global_key_to_upload_dict ,
106
106
skip_duplicates = skip_duplicates , divider = divider , verbose = verbose
107
107
)
108
108
109
+ # Default global_key_col if row_data_col not provided
110
+ global_key_col = global_key_col if global_key_col else row_data_col
111
+
112
+ # Create a dictionary where {key=global_key : value=data_row_id}
113
+ global_key_to_data_row_id = uploader .create_global_key_to_data_row_dict (
114
+ client = self .lb_client , global_keys = connector .get_unique_values_function (table , global_key_col )
115
+ )
116
+
109
117
# Create a dictionary where {key=project_id : value=list_of_data_row_ids}, if applicable
110
118
project_id_to_batch_dict = connector .create_batches (
111
- client = self .lb_client , table = table , global_key_col = global_key_col , project_id_col = project_id_col
119
+ client = self .lb_client , table = table , global_key_col = global_key_col ,
120
+ project_id_col = project_id_col , global_key_to_data_row_id = global_key_to_data_row_id
112
121
)
113
122
114
123
# Batch data rows to projects, if applicable
115
- batch_results = batch_rows_to_project (
124
+ batch_results = uploader . batch_rows_to_project (
116
125
client = self .lb_client , project_id_to_batch_dict , priority = priority
117
126
)
118
127
@@ -123,7 +132,7 @@ def create_data_rows_from_table(
123
132
)
124
133
125
134
# Upload your annotations to Labelbox, if applicable
126
- annotation_upload_results = batch_upload_annotations (
135
+ annotation_upload_results = uploader . batch_upload_annotations (
127
136
client = self .lb_client , project_id_to_upload_dict = project_id_to_upload_dict , how = upload_method , verbose = verbose
128
137
)
129
138
0 commit comments