IBM Watson visual recognition service on Bluemix always returns empty content
I am trying to test the IBM Watson visual recognition service on Bluemix using the API tester.
1st I want to get a list of valid labels:
- I open the API tester: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/visual-recognition/getLabelService
- I am outputting an empty line
- Response body: no content, response code: 0
While reading the source code of the demo application, I was outputting labels eg. "Animal"
- I open this link: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/visual-recognition/recognizeLabelsService
- I upload images and set the label to "Animals"
- Response body: no content, response code: 0
Any idea what I am doing wrong?
The demo app seems to work well enough, at least it recognizes Obama's image as "man, president, Obama" :)
+3
source to share
1 answer
Check out the links below for some examples of using this service.
If you were using the image http://visual-recognition-demo.mybluemix.net/images/63992.jpg . A post request to Watson will look like this.
All server side code (Node.Js) streams the image to Watson.
function(req, res) {
var stream = fs.createReadStream(req.files.imgFile.path);
var params = {
image_file: stream
};
visualRecognition.recognize(params, function(error, result) {
if (error) {
return res.status(error.error ? error.error.code || 500 : 500).json({ error: error });
} else {
return res.json(result);
}
});
}
A demo to upload your own image and identify it
The code for the above application is available here .
+4
source to share