1
1
from labelbox import Client
2
+ from labelbase import Client as baseClient
2
3
import pandas
3
4
4
- def create_upload_dict (df :pandas .core .frame .DataFrame , local_files :bool , lb_client :Client , row_data_col :str ,
5
+ def create_upload_dict (df :pandas .core .frame .DataFrame , local_files :bool , lb_client :Client , base_client : baseClient , row_data_col :str ,
5
6
global_key_col :str = "" , external_id_col :str = "" , metadata_index :dict = {}, divider :str = "///" ):
6
7
""" Multithreads over a Pandas DataFrame, calling create_data_rows() on each row to return an upload dictionary
7
8
Args:
8
9
df : Required (pandas.core.frame.DataFrame) - Pandas DataFrame
9
10
local_files : Required (bool) - If True, will create urls for local files / If False, treats the values in `row_data_col` as urls
10
11
lb_client : Required (labelbox.client.Client) - Labelbox Client object
12
+ base_client : Required (labelbase.client.Client) - Labelbase Client object
11
13
row_data_col : Required (str) - Column name where the data row row data URL is located
12
14
global_key_col : Optional (str) - Column name where the data row global key is located - defaults to the row_data_col
13
15
external_id_col : Optional (str) - Column name where the data row external ID is located - defaults to the global_key_col
@@ -18,8 +20,8 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, local_files:bool, lb_clie
18
20
"""
19
21
global_key_col = global_key_col if global_key_col else row_data_col
20
22
external_id_col = external_id_col if external_id_col else global_key_col
21
- metadata_schema_to_name_key = get_metadata_schema_to_name_key (lb_mdo = False , divider = divider , invert = False )
22
- metadata_name_key_to_schema = get_metadata_schema_to_name_key (lb_mdo = False , divider = divider , invert = True )
23
+ metadata_schema_to_name_key = base_client . get_metadata_schema_to_name_key (lb_mdo = False , divider = divider , invert = False )
24
+ metadata_name_key_to_schema = base_client . get_metadata_schema_to_name_key (lb_mdo = False , divider = divider , invert = True )
23
25
global_key_to_upload_dict = {}
24
26
futures = []
25
27
with ThreadPoolExecutor () as exc :
0 commit comments