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

Commit dbe64a5

Browse files
Update client.py
1 parent 88b2a60 commit dbe64a5

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

labelpandas/client.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,28 @@ def create_data_rows_from_table(
153153
skip_duplicates=skip_duplicates, divider=divider, verbose=verbose
154154
)
155155

156+
# If performing actions that require data row IDs, we pull them here
157+
if actions["batch"] or actions["annotate"] or actions["prediction"]:
158+
global_key_to_data_row_id = uploader.create_global_key_to_data_row_id_dict(
159+
client=self.lb_client, global_keys=list(upload_dict.keys())
160+
)
161+
156162
# Bath to project attempt using labelbase.uploader.batch_rows_to_project
157163
if actions["batch"]:
158164
batch_to_project_results = batch_rows_to_project(
159-
client=self.lb_client, upload_dict=upload_dict, priority=priority, verbose=verbose
165+
client=self.lb_client, upload_dict=upload_dict,
166+
global_key_to_data_row_id=global_key_to_data_row_id,
167+
priority=priority, verbose=verbose
160168
)
161169
else:
162170
batch_to_project_results = []
163171

164172
# Annotation upload attempt using labelbase.uploader.batch_upload_annotations
165173
if actions["annotate"]:
166174
annotation_upload_results = batch_upload_annotations(
167-
client=self.lb_client, upload_dict=upload_dict, how=actions["annotate"], verbose=verbose
175+
client=self.lb_client, upload_dict=upload_dict,
176+
global_key_to_data_row_id=global_key_to_data_row_id,
177+
how=actions["annotate"], verbose=verbose
168178
)
169179
else:
170180
annotation_upload_results = []
@@ -182,10 +192,11 @@ def create_data_rows_from_table(
182192
# If data rows aren't in the model run yet, add them with labelbase.uploader.batch_add_data_rows_to_model_run
183193
if not ground_truth_upload_results:
184194
data_row_to_model_run_results = batch_add_data_rows_to_model_run(
185-
client=self.lb_client, upload_dict=upload_dict
195+
client=self.lb_client, upload_dict=upload_dict
186196
)
187197
prediction_upload_results = batch_upload_predictions(
188-
client=self.lb_client, upload_dict=upload_dict
198+
client=self.lb_client, upload_dict=upload_dict,
199+
global_key_to_data_row_id=global_key_to_data_row_id
189200
)
190201
else:
191202
data_row_to_model_run_results = []

0 commit comments

Comments
 (0)