Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit a3595ff

Browse files
Update uploader.py
1 parent 9c7cff8 commit a3595ff

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

labelpandas/uploader.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ def create_upload_dict(client:labelboxClient, table: pandas.core.frame.DataFrame
7777
print(f'Creating upload list - {table_length} rows in Pandas DataFrame')
7878
# Get your global keys
7979
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}
8280
if table_length != len(global_keys):
8381
print(f"Warning: Your global key column is not unique - upload will resume, only uploading 1 data row per unique global key")
8482
# 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
131129
for model_id in model_id_to_model_run_id.keys():
132130
model_run_id = model_id_to_model_run_id[model_id]
133131
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
136133
)
137134
model_run_id_to_ontology_index[model_run_id] = ontology_index
138135
# Multithread creating upload_dict global_key dictionaries
136+
upload_dict = {}
139137
with ThreadPoolExecutor(max_workers=8) as exc:
140138
futures = []
141139
for row_dict in table_dict:
@@ -150,10 +148,10 @@ def create_upload_dict(client:labelboxClient, table: pandas.core.frame.DataFrame
150148
))
151149
for f in as_completed(futures):
152150
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"])
155153
upload_dict[global_key] = {
156-
"data_row" : dataRow,
154+
"data_row" : res["data_row"],
157155
"project_id" : res["project_id"],
158156
"annotations" : res["annotations"],
159157
"model_run_id" : res["model_run_id"],

0 commit comments

Comments
 (0)