1919from .projects import Project
2020from .version import __version__
2121
22+
2223class DeploymentType (Enum ):
2324 """Specify the storage medium being used by your Unbox deployment."""
2425
@@ -50,7 +51,7 @@ class UnboxClient(object):
5051
5152 def __init__ (self , api_key : str ):
5253 self .api = Api (api_key )
53- self .subscription_plan = self .api .get_request ("users/subscriptionPlan " )
54+ self .subscription_plan = self .api .get_request ("me/subscription-plan " )
5455
5556 if DEPLOYMENT == DeploymentType .AWS :
5657 self .upload = self .api .upload_blob_s3
@@ -61,21 +62,14 @@ def __init__(self, api_key: str):
6162 else :
6263 self .upload = self .api .transfer_blob
6364
64- def create_project (
65- self ,
66- name : str ,
67- description : str ,
68- ):
69- endpoint = "initialize_project"
70- payload = dict (
71- name = name ,
72- description = description ,
73- )
65+ def create_project (self , name : str , description : str ):
66+ endpoint = "projects"
67+ payload = dict (name = name , description = description )
7468 project_data = self .api .post_request (endpoint , body = payload )
7569 return Project (project_data , self .upload , self .subscription_plan , self )
7670
7771 def load_project (self , name : str ):
78- endpoint = f"load_project /{ name } "
72+ endpoint = f"projects /{ name } "
7973 project_data = self .api .get_request (endpoint )
8074 return Project (project_data , self .upload , self .subscription_plan , self )
8175
@@ -440,14 +434,14 @@ def add_model(
440434 with tarfile .open (tarfile_path , mode = "w:gz" ) as tar :
441435 tar .add (temp_dir , arcname = bento_service .name )
442436
443- endpoint = " models"
437+ endpoint = f"projects/ { project_id } /ml- models"
444438 payload = dict (
445439 name = name ,
446440 project_id = project_id ,
447441 description = description ,
448442 classNames = class_names ,
449443 taskType = task_type .value ,
450- type = model_type .name ,
444+ architectureType = model_type .name ,
451445 kwargs = list (kwargs .keys ()),
452446 featureNames = feature_names ,
453447 categoricalFeatureNames = categorical_feature_names ,
@@ -650,7 +644,7 @@ def add_dataset(
650644 raise UnboxException (
651645 "Label / text / feature / tag column names not in dataset."
652646 )
653- endpoint = " datasets"
647+ endpoint = f"projects/ { project_id } / datasets"
654648 payload = dict (
655649 name = name ,
656650 project_id = project_id ,
@@ -686,7 +680,7 @@ def add_dataframe(
686680 description : Optional [str ] = None ,
687681 tag_column_name : Optional [str ] = None ,
688682 language : str = "en" ,
689- project_id : str = None
683+ project_id : str = None ,
690684 ) -> Dataset :
691685 r"""Uploads a dataset to the Unbox platform (from a pandas DataFrame).
692686
@@ -828,7 +822,7 @@ def add_dataframe(
828822 language = language ,
829823 feature_names = feature_names ,
830824 categorical_feature_names = categorical_feature_names ,
831- project_id = project_id
825+ project_id = project_id ,
832826 )
833827
834828 @staticmethod
@@ -841,4 +835,3 @@ def _validate_categorical_features(
841835 f"Feature '{ feature } ' contains more options in the df than provided "
842836 "for it in `categorical_features_map`"
843837 )
844-
0 commit comments