Author: Gaurav Sood
Date: 2015-11-10

# Using clarifai

#### Gaurav Sood

#### 2015-11-10

## Using clarifai

### Installation

To get the current development version from GitHub:

    # install.packages("devtools")
    devtools::install_github("soodoku/clarifai")

#### Load up the lib:

    library(clarifai)

#### Authentication

Start by setting Client ID and secret, which you can get from https://developer.clarifai.com/

    secret_id(c("client_id", "secret"))

Next, get the token (the function also sets it):

    get_token()

#### Get Information

Get information about your application:

    get_info()

    ## Status message:  All images in request have completed successfully.

#### Get Tags

We are now all set. Let’s play. Get tags of a remote image:

Metro North

    res <- tag_image_urls("https://raw.githubusercontent.com/soodoku/clarifai/master/inst/extdata/metro-north.jpg")
    head(res)

Get tags for a local image:

    path <- system.file("inst/extdata/", package = "clarifai")
    filep <- paste0(path, "/metro-north.jpg")
    tag_images(filep)

Provide feedback about tags for an image, including suggesting new tags, suggesting that some tags be removed etc.

#### Provide Feedback

    feedback(file_path="path_to_image", feedback_type="add_tags", feedback_value="suggested_tag")