Skip to content

Commit

Permalink
review_changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaychelliah committed Aug 3, 2023
1 parent 6e1c1b1 commit 92ca1ee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions clarifai/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def dataset(self, dataset_id: str, **kwargs) -> Dataset:
if response.status.code != status_code_pb2.SUCCESS:
raise Exception(response.status)

return Dataset(dataset_id=dataset_id, **kwargs)
return Dataset(dataset_id=dataset_id, dataset_info=response.dataset)

def model(self, model_id: str, **kwargs) -> Model:
"""Returns a Model object for the existing model ID.
Expand All @@ -129,7 +129,7 @@ def model(self, model_id: str, **kwargs) -> Model:
if response.status.code != status_code_pb2.SUCCESS:
raise Exception(response.status)

return Model(model_id=model_id, **kwargs)
return Model(model_id=model_id, model_info=response.model)

def workflow(self, workflow_id: str, **kwargs) -> Workflow:
"""Returns a workflow object for the existing workflow ID.
Expand All @@ -144,7 +144,7 @@ def workflow(self, workflow_id: str, **kwargs) -> Workflow:
if response.status.code != status_code_pb2.SUCCESS:
raise Exception(response.status)

return Workflow(workflow_id=workflow_id, **kwargs)
return Workflow(workflow_id=workflow_id, workflow_info=response.workflow)

def delete_dataset(self, dataset_id: str) -> None:
"""Deletes an dataset for the user.
Expand Down
6 changes: 4 additions & 2 deletions clarifai/client/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ class Dataset(BaseClient):
Inherits from BaseClient for authentication purposes.
"""

def __init__(self, dataset_id: str, **kwargs):
def __init__(self, dataset_id: str, dataset_info: resources_pb2.Dataset = None, **kwargs):
"""Initializes an Dataset object.
Args:
dataset_id (str): The Dataset ID within the App to interact with.
**kwargs: Additional keyword arguments to be passed to the ClarifaiAuthHelper.
"""
self.kwargs = {**kwargs, 'id': dataset_id}
self.dataset_info = resources_pb2.Dataset(**self.kwargs)
self.dataset_info = resources_pb2.Dataset(
**self.kwargs) if dataset_info is None else dataset_info
super().__init__(app_id=self.app_id)

def __getattr__(self, name):
return getattr(self.dataset_info, name)
Expand Down
5 changes: 3 additions & 2 deletions clarifai/client/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ class Model(BaseClient):
Inherits from BaseClient for authentication purposes.
"""

def __init__(self, model_id: str, **kwargs):
def __init__(self, model_id: str, model_info: resources_pb2.Model = None, **kwargs):
"""Initializes an Model object.
Args:
model_id (str): The Model ID to interact with.
**kwargs: Additional keyword arguments to be passed to the ClarifaiAuthHelper.
"""
self.kwargs = {**kwargs, 'id': model_id}
self.model_info = resources_pb2.Model(**self.kwargs)
self.model_info = resources_pb2.Model(**self.kwargs) if model_info is None else model_info
super().__init__(app_id=self.app_id)

def __getattr__(self, name):
return getattr(self.model_info, name)
Expand Down
6 changes: 4 additions & 2 deletions clarifai/client/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ class Workflow(BaseClient):
Inherits from BaseClient for authentication purposes.
"""

def __init__(self, workflow_id: str, **kwargs):
def __init__(self, workflow_id: str, workflow_info: resources_pb2.Workflow = None, **kwargs):
"""Initializes an Workflow object.
Args:
workflow_id (str): The Workflow ID to interact with.
**kwargs: Additional keyword arguments to be passed to the ClarifaiAuthHelper.
"""
self.kwargs = {**kwargs, 'id': workflow_id}
self.workflow_info = resources_pb2.Workflow(**self.kwargs)
self.workflow_info = resources_pb2.Workflow(
**self.kwargs) if workflow_info is None else workflow_info
super().__init__(app_id=self.app_id)

def __getattr__(self, name):
return getattr(self.workflow_info, name)
Expand Down

0 comments on commit 92ca1ee

Please sign in to comment.