def __init__(self, model_name, project_id=None):
"""
Args:
model_name: the name of the model. It can be a model full name
("projects/[project_id]/models/[model_name]") or just [model_name].
project_id: project_id of the models. If not provided and model_name is not a full name
(not including project_id), default project_id will be used.
"""
if project_id is None:
self._project_id = datalab.Context.default().project_id
self._credentials = datalab.Context.default().credentials
self._api = discovery.build('ml', 'v1', credentials=self._credentials)
if not model_name.startswith('projects/'):
model_name = ('projects/%s/models/%s' % (self._project_id, model_name))
self._full_model_name = model_name
self._model_name = self._full_model_name.split('/')[-1]
评论列表
文章目录