Skip to content

mitmedialab/MoboWater-Mobile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clarifai-ios-starter

This is a simple project to get you started using the Clarifai API in iOS apps. It includes usage of the API in both Swift and Objective-C. Full Clarifai API documentation can be found at developer.clarifai.com.

Building and Running

Build Status

To build this project, you need Xcode 7 and CocoaPods. To build and run:

  1. Install dependencies and generate workspace.
pod install
  1. Open the workspace in Xcode
open ClarifaiApiDemo.xcworkspace
  1. Go to developer.clarifai.com/applications, click on your application, then copy the "Client ID" and "Client Secret" values (if you don't already have an account or application, you'll need to create them first).

    Replace the values of clarifaiClientID and clarifaiClientSecret in Credentials.swift with the ones you copied.

  2. Press the "Play" button in the toolbar to build, install, and run the app.

Swift

SwiftRecognitionViewController is a simple view controller written in Swift. It prompts the user to select a photo from their photo library and sends it to the Clarifai API for tagging.

Objective-C

RecognitionViewController is a simple view controller written in Objective-C. It prompts the user to select a photo from their photo library and sends it to the Clarifai API for tagging. The Objective-C version is not enabled by default. To use it, you need to:

  1. Open Main.storyboard in XCode
  2. Select "Clarifai Scene"
  3. In the Identity Inspector, change the custom class to RecognitionViewController

Custom Training

This project supports prediction against custom-trained concepts. Once you train a concept (instructions here), you can call the predictJpegs and predictURLs methods on ClarifaiClient to get back scores indicating how well images match the concept. A simple example can be enabled by setting the ConceptName constant in SwiftRecognitionViewController or kConceptName in RecognitionViewController.

Custom concepts are private to a given application. As a result, you must ensure that the same app ID and app secret are used for both training and prediction.

Next steps

Feel free to use this project as a base for building your app. Alternately, you can copy ClarifaiClient.h and ClarifaiClient.m into a your own project and use them to make calls to Clarifai. Have fun!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published