Skip to content

Instantly share code, notes, and snippets.

@JustinBeckwith
Last active June 27, 2018 21:29
Show Gist options
  • Save JustinBeckwith/c97790f64c1635b0da108ed14e9a29a1 to your computer and use it in GitHub Desktop.
Save JustinBeckwith/c97790f64c1635b0da108ed14e9a29a1 to your computer and use it in GitHub Desktop.
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