clarifai-0.1.1.0: API Client for the Clarifai API.

Copyright(c) Joseph Canero, 2015
LicenseMIT
Maintainercaneroj1@tcnj.edu
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Network.Clarifai

Description

Provides functionality for interacting with Clarifai's Image Tagging API. Allows users to submit images/videos to be recognized and tagged by Clarifai. Users will need a Clarifai account to make full use of this client.

Synopsis

Documentation

data VerificationStatus Source

Enum type for verifying FilePaths before sending to the API.

Constructors

Good 
Bad 
Unknown 

data Client Source

The Client data type has two constructors. The first should be used when constructing a client with an access token. The second constructor should be used when passing in an application's client id and client secret. The flow usually proceeds by creating an App and then authorizing it.

Constructors

Client String 
App String String 

Instances

data TagSet Source

A TagSet represents a single result from the Tag endpoint. A TagSet is identified uniquely by its docID, and uniquely within a request by its localID. The most important feature of the TagSet is the vector of Tags.

Constructors

TagSet 

Instances

data Info Source

The Info data type is used to encapsulate a response from the /info endpoint. This type contains information about the various usage limits for the API.

Instances

data Tag Source

A Tag is a pair of String and Double and represents a word class from the Clarifai model and the associated probability.

Constructors

Tag String Double 

Instances

verifyImageBatchSize :: Info -> [FilePath] -> Bool Source

Given an API Info type and a list of FilePaths, we verify the length of the list with what the Info type specifies is acceptable batch size for images. This function assumes that the FilePaths all point to images.

verifyVideoBatchSize :: Info -> [FilePath] -> Bool Source

Given an API Info type and a list of FilePaths, we verify the length of the list with what the Info type specifies is acceptable batch size for videos. This function assumes that the FilePaths all point to videos.

verifyFiles :: Info -> [FilePath] -> IO [(FilePath, IO VerificationStatus)] Source

Given an API Info type and a list of FilePaths, we verify each of the files. If the file has an extension, we decide which Info attribute to use to verify the file. If it has no extension, we choose not to verify. This function maps each FilePath to a tuple of (FilePath, VerificationStatus), where VerificationStatus = Good | Bad | Unknown

authorize :: Client -> IO (Either Errors Client) Source

Authorize an application Sends a POST request to Clarifai's authentication endpoint. If we have a Client, we just return the client because I'm assuming the client was constructed with a valid access token. If we have an App, we would POST the client ID and client secret to Clarifai to get an access token.

info :: Client -> IO (Either Errors Info) Source

Gets the Clarifai API limits and information. Sends a get request to the /info endpoint and encapsulates the results into an Info type.

tag :: Client -> [FilePath] -> IO (Either Errors (Vector TagSet)) Source

Utilizes the tag endpoint of the clarifai API to tag multiple files from the local file system.