Beispiel #1
0
    def test_api_init(self):
        api = ApiClient()

        if os.environ.get('CLARIFAI_API_KEY'):
            key = os.environ['CLARIFAI_API_KEY']

            api = ApiClient(api_key=key)

            if os.environ.get('CLARIFAI_API_BASE'):
                api_base = os.environ['CLARIFAI_API_BASE']
                api = ApiClient(api_key=key, base_url=api_base)
  def test_shorcut_predict_functions(self):

    img1 = ClImage(url=urls[0])
    api = ApiClient()
    api.predict_concepts([img1])

    api.predict_colors([img1])

    api.predict_embed([img1])
Beispiel #3
0
from clarifai.rest import ApiClient, Image
from flask import Flask, request, redirect, url_for, send_from_directory
from clarifai.client import ClarifaiApi
import json

app_id = "-Vi-qtSkO7YoquYqPUbjR-In9G74Y7TYoAyQsnA5"
app_secret = "VaVyBbyvmnpoyvOehbDjsnh284T7Nx751LkSVd5H"

## API Client
clarifai_api = ClarifaiApi()

####################################################################################################

## create our endpoint
##Debug: print "Recieving access token:\n "
api = ApiClient(client_id=app_id, client_secret=app_secret)
######################################## sample images for debuggin  #################################
img1 = Image(
    url=
    'https://www.royalcanin.com/~/media/Royal-Canin/Product-Categories/cat-adult-landing-hero.ashx',
    labels=['cat'])
img2 = Image(
    url=
    'http://static.independent.co.uk/s3fs-public/styles/article_large/public/thumbnails/image/2016/02/25/13/cat-getty_0.jpg',
    labels=['cat'])
img3 = Image(url='http://www.lafayettecountyhealth.org/ThreePeople.jpg')

######################################## images for a programmer #####################################
computer_img1 = Image(
    url='https://static.pexels.com/photos/6218/desk-laptop-notebook-table.jpg',
    labels=['computer'])
Beispiel #4
0
 def setUpClass(cls):
     cls.api = ApiClient(log_level=logging.WARN)
     cls.app = ClarifaiApp(log_level=logging.WARN)
Beispiel #5
0
 def setUpClass(cls):
     cls.api = ApiClient()
Beispiel #6
0
 def setUpClass(cls):
     cls.api = ApiClient(log_level=logging.WARN)