Skip to content
Clarifai library for Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Use JSON for tag and feedback requests. Dec 7, 2015
LICENSE Create LICENSE May 14, 2016
README.md add disclaimer for v1 api (#17) Aug 28, 2017
client.go Use JSON for tag and feedback requests. Dec 7, 2015
client_test.go
requests.go docid is a big int (#5) May 24, 2016
requests_test.go docid is a big int (#5) May 24, 2016

README.md

Clarifai Golang Library

Library for our v1 API.

GoDoc

Disclaimer

This API client only supports Clarifai v1 API. Stay tuned for the v2 support.

Usage

go get github.com/clarifai/clarifai-go

package main

import (
	"fmt"

	"github.com/clarifai/clarifai-go"
)

func main() {
	client := clarifai.NewClient("<client_id>", "<client_secret>")
	// Get the current status of things
	info, err := client.Info()
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%+v\n", info)
	}
	// Let's get some context about these images
	urls := []string{"https://samples.clarifai.com/metro-north.jpg", "https://samples.clarifai.com/puppy.jpeg"}
	// Give it to Clarifai to run their magic
	tag_data, err := client.Tag(clarifai.TagRequest{URLs: urls})

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%+v\n", tag_data) // See what we got!
	}

	feedback_data, err := client.Feedback(clarifai.FeedbackForm{
		URLs:    urls,
		AddTags: []string{"cat", "animal"},
	})

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%+v\n", feedback_data)
	}
}

Testing

Run go test

##Special Thanks

Thanks so much to Sam Couch for his amazing contribution to the Clarifai client libraries by starting this one and graciously handing it off to us. Follow him on Twitter @SamuelCouch.

You can’t perform that action at this time.