Last active
June 27, 2018 21:29
-
-
Save JustinBeckwith/c97790f64c1635b0da108ed14e9a29a1 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
const {google} = require('googleapis'); | |
async function cmlePredict(description_text) { | |
const client = await google.auth.getClient({ | |
scopes: [ | |
'https://www.googleapis.com/auth/cloud-platform' | |
] | |
}); | |
const ml = google.ml('v1'); | |
const params = { | |
auth: client, | |
name: 'projects/next18-movies-demo/models/movies_v1', | |
resource: { | |
instances: [{ | |
inputs: { | |
values: [description_text] | |
} | |
}] | |
} | |
}; | |
const res = await ml.projects.predict(params); | |
console.log('got a cmle result', res.data); | |
return res.data; | |
}); | |
cmlePredict().catch(console.error); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment