@@ -77,8 +77,6 @@ def create_upload_dict(client:labelboxClient, table: pandas.core.frame.DataFrame
77
77
print (f'Creating upload list - { table_length } rows in Pandas DataFrame' )
78
78
# Get your global keys
79
79
global_keys = get_unique_values (table = table , col = global_key_col , extra_client = extra_client )
80
- # Your upload dict keys are all your dataset IDs
81
- upload_dict = {gk : {} for gk in global_keys }
82
80
if table_length != len (global_keys ):
83
81
print (f"Warning: Your global key column is not unique - upload will resume, only uploading 1 data row per unique global key" )
84
82
# Get dictionaries where {key=metadata_name_key : value=metadata_schema_id}
@@ -131,11 +129,11 @@ def create_upload_dict(client:labelboxClient, table: pandas.core.frame.DataFrame
131
129
for model_id in model_id_to_model_run_id .keys ():
132
130
model_run_id = model_id_to_model_run_id [model_id ]
133
131
ontology_index = get_ontology_schema_to_name_path (
134
- ontology = client .get_model (model_id ).ontology (),
135
- divider = divider , invert = True , detailed = True
132
+ ontology = client .get_model (model_id ).ontology (), divider = divider , invert = True , detailed = True
136
133
)
137
134
model_run_id_to_ontology_index [model_run_id ] = ontology_index
138
135
# Multithread creating upload_dict global_key dictionaries
136
+ upload_dict = {}
139
137
with ThreadPoolExecutor (max_workers = 8 ) as exc :
140
138
futures = []
141
139
for row_dict in table_dict :
@@ -150,10 +148,10 @@ def create_upload_dict(client:labelboxClient, table: pandas.core.frame.DataFrame
150
148
))
151
149
for f in as_completed (futures ):
152
150
res = f .result ()
153
- dataRow = res [ "data_row" ]
154
- global_key = str (dataRow ["global_key" ])
151
+ print ( res )
152
+ global_key = str (res [ "data_row" ] ["global_key" ])
155
153
upload_dict [global_key ] = {
156
- "data_row" : dataRow ,
154
+ "data_row" : res [ "data_row" ] ,
157
155
"project_id" : res ["project_id" ],
158
156
"annotations" : res ["annotations" ],
159
157
"model_run_id" : res ["model_run_id" ],
0 commit comments