This Python client provides a simple wrapper around our powerful image recognition API.
The client supports basic tagging with existing models.
The client also uses Applications to store images and visually search across them. You can either do a simple visual search or also add predictions for any, all or none, as noted in the directions below.
Unzip the package to somewhere then run setup.py to install:
pip install clarifai==2.0.10
The client uses your "CLARIFAI_APP_ID" and "CLARIFAI_APP_SECRET" to get an access token. Since this expires every so often, the client is setup to renew the token for you automatically using your credentials so you don't have to worry about it.
You can get the id
and secret
from https://developer.clarifai.com and config them for client's use by
$ clarifai config
CLARIFAI_APP_ID: []: ************************************YQEd
CLARIFAI_APP_SECRET: []: ************************************gCqT
The config will be stored under ~/.clarifai/config for client's use
Environmental variable CLARIFAI_APP_ID and CLARIFAI_APP_SECRET will override the settings in the config file.
The following example will setup the client and predict from our general model
from clarifai.rest import ClarifaiApp
app = ClarifaiApp()
model = app.models.get('general-v1.3')
print model.predict_by_url('https://samples.clarifai.com/metro-north.jpg')
Read more code examples and references at https://sdk.clarifai.com/python/docs/2.0.10/index.html