Last active
February 23, 2018 01:00
-
-
Save ammardodin/698561b1150fdfc0bb065bcafa98709a to your computer and use it in GitHub Desktop.
Use a UInt8Array with createClassifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var VisualRecognitionV3 = require('watson-developer-cloud/visual-recognition/v3'); | |
var toBuffer = require('typedarray-to-buffer') | |
var visualRecognition = new VisualRecognitionV3({ | |
api_key: 'INSERT YOUR API KEY HERE', | |
version: '2016-05-20' | |
}); | |
var catClassImages = toBuffer(<YOUR_BYTE_ARRAY>); | |
var dogClassImages = toBuffer(<YOUR_BYTE_ARRAY>); | |
var params = { | |
cat_positive_examples: catClassImages, | |
negative_examples: dogClassImages, | |
name: 'my-cat-classifier' | |
}; | |
visualRecognition.createClassifier(params, function(err, res) { | |
if (err) { | |
console.log(err); | |
} else { | |
console.log(JSON.stringify(res, null, 2)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment