コード例 #1
0
ファイル: clarifai_basic.py プロジェクト: mhijazi1/Karma
    def __init__(self, app_id=None, app_secret=None):
        self._collection_id = 'hackmit'
        self.request_helper = CuratorApiRequestHelper(
            collection_id=self._collection_id)
        super(CuratorApiClient,
              self).__init__(app_id=app_id,
                             app_secret=app_secret,
                             base_url='https://api-alpha.clarifai.com',
                             wait_on_throttle=True)

        self.add_url('document',
                     'curator/collections/%s/documents' % self._collection_id)
        self.add_url('collections', 'curator/collections')
        self.add_url('concepts', 'curator/concepts')
        self.add_url('concept', 'curator/concepts/{namespace}/{cname}')
        self.add_url('concept_predict',
                     'curator/concepts/{namespace}/{cname}/predict')
        self.add_url('concept_train',
                     'curator/concepts/{namespace}/{cname}/train')
        self.add_url('model_predict', 'curator/models/{name}/predict')
コード例 #2
0
    def __init__(self,
                 app_id='sKU_ax7BliXvEqfsutM5enhvkZ0ZSnWcnhEOuXxR',
                 app_secret='x-Q4HeMzasp8p153TBwgBmk0PD5QgFWnKndvtNGr'):
        self._collection_id = 'hackmit'
        self.request_helper = CuratorApiRequestHelper(
            collection_id=self._collection_id)
        super(CuratorApiClient,
              self).__init__(app_id=app_id,
                             app_secret=app_secret,
                             base_url='https://api-alpha.clarifai.com',
                             wait_on_throttle=True)

        self.add_url('document',
                     'curator/collections/%s/documents' % self._collection_id)
        self.add_url('collections', 'curator/collections')
        self.add_url('concepts', 'curator/concepts')
        self.add_url('concept', 'curator/concepts/{namespace}/{cname}')
        self.add_url('concept_predict',
                     'curator/concepts/{namespace}/{cname}/predict')
        self.add_url('concept_train',
                     'curator/concepts/{namespace}/{cname}/train')
        self.add_url('model_predict', 'curator/models/{name}/predict')