1
1
from labelbox import Client as labelboxClient
2
- from labelbase import Client as labelbaseClient
3
2
from labelbox .schema .dataset import Dataset as labelboxDataset
3
+ from labelbase .metadata import sync_metadata_fields
4
+ from labelbase .uploaders import batch_create_data_rows
4
5
import pandas as pd
5
6
from labelpandas import connector
6
7
@@ -22,7 +23,6 @@ def __init__(
22
23
lb_app_url = "https://app.labelbox.com" ):
23
24
24
25
self .lb_client = labelboxClient (lb_api_key , endpoint = lb_endpoint , enable_experimental = lb_enable_experimental , app_url = lb_app_url )
25
- self .base_client = labelbaseClient (lb_api_key , lb_endpoint = lb_endpoint , lb_enable_experimental = lb_enable_experimental , lb_app_url = lb_app_url )
26
26
27
27
# def create_table_from_dataset():
28
28
# return table
@@ -54,8 +54,8 @@ def create_data_rows_from_table(
54
54
"""
55
55
56
56
# Ensure all your metadata_index keys are metadata fields in Labelbox and that your Pandas DataFrame has all the right columns
57
- table = self . base_client . sync_metadata_fields (
58
- table = table , get_columns_function = connector .get_columns_function , add_column_function = connector .add_column_function ,
57
+ table = sync_metadata_fields (
58
+ client = self . lb_client , table = table , get_columns_function = connector .get_columns_function , add_column_function = connector .add_column_function ,
59
59
get_unique_values_function = connector .get_unique_values_function , metadata_index = metadata_index , verbose = verbose
60
60
)
61
61
@@ -65,7 +65,7 @@ def create_data_rows_from_table(
65
65
66
66
# Create a dictionary where {key=global_key : value=labelbox_upload_dictionary} - this is unique to Pandas
67
67
global_key_to_upload_dict , conversion_errors = connector .create_upload_dict (
68
- table = table , lb_client = self .lb_client , base_client = self . base_client ,
68
+ table = table , lb_client = self .lb_client ,
69
69
row_data_col = row_data_col , global_key_col = global_key_col , external_id_col = external_id_col ,
70
70
metadata_index = metadata_index , local_files = local_files , divider = divider , verbose = verbose
71
71
)
@@ -80,8 +80,8 @@ def create_data_rows_from_table(
80
80
return {"upload_results" : [], "conversion_errors" : errors }
81
81
82
82
# Upload your data rows to Labelbox
83
- upload_results = self . base_client . batch_create_data_rows (
84
- dataset = lb_dataset , global_key_to_upload_dict = global_key_to_upload_dict ,
83
+ upload_results = batch_create_data_rows (
84
+ client = self . lb_client , dataset = lb_dataset , global_key_to_upload_dict = global_key_to_upload_dict ,
85
85
skip_duplicates = skip_duplicates , divider = divider , verbose = verbose
86
86
)
87
87
0 commit comments