Created
May 13, 2017 22:23
-
-
Save ozozozd/40905481b9cbb3b2326d759367ae34ab to your computer and use it in GitHub Desktop.
This file contains 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
export default (request) => { | |
const kvstore = require('kvstore'); | |
const xhr = require('xhr'); | |
const http_options = { | |
"method": "POST", | |
"headers": { | |
"Authorization": "Bearer xvEdXQG3nyyXoFldhgvaoDE7Plipdz", | |
"Content-Type": "application/json" | |
}, | |
"body": JSON.stringify({ | |
"inputs": [ | |
{ | |
"data": { | |
"image": { | |
"url": "https://samples.clarifai.com/metro-north.jpg" | |
} | |
} | |
} | |
] | |
}) | |
}; | |
const url = "https://api.clarifai.com/v2/models/aaa03c23b3724a16a56b629203edc62c/outputs"; | |
console.log('request',request); // Log the request envelope passed | |
return xhr.fetch(url, http_options).then((x) => { | |
const body = JSON.parse(x.body); | |
console.log(body); | |
return request.ok(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment