MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

automl/get_model.js:17–59  ·  view source on GitHub ↗
(
  projectId = 'YOUR_PROJECT_ID',
  location = 'us-central1',
  modelId = 'YOUR_MODEL_ID'
)

Source from the content-addressed store, hash-verified

15'use strict';
16
17function main(
18 projectId = 'YOUR_PROJECT_ID',
19 location = 'us-central1',
20 modelId = 'YOUR_MODEL_ID'
21) {
22 // [START automl_get_model]
23 /**
24 * TODO(developer): Uncomment these variables before running the sample.
25 */
26 // const projectId = 'YOUR_PROJECT_ID';
27 // const location = 'us-central1';
28 // const modelId = 'YOUR_MODEL_ID';
29
30 // Imports the Google Cloud AutoML library
31 const {AutoMlClient} = require('@google-cloud/automl').v1;
32
33 // Instantiates a client
34 const client = new AutoMlClient();
35
36 async function getModel() {
37 // Construct request
38 const request = {
39 name: client.modelPath(projectId, location, modelId),
40 };
41
42 const [response] = await client.getModel(request);
43
44 console.log(`Model name: ${response.name}`);
45 console.log(
46 `Model id: ${
47 response.name.split('/')[response.name.split('/').length - 1]
48 }`
49 );
50 console.log(`Model display name: ${response.displayName}`);
51 console.log('Model create time');
52 console.log(`\tseconds ${response.createTime.seconds}`);
53 console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
54 console.log(`Model deployment state: ${response.deploymentState}`);
55 }
56
57 getModel();
58 // [END automl_get_model]
59}
60
61process.on('unhandledRejection', err => {
62 console.error(err.message);

Callers 1

get_model.jsFile · 0.70

Calls 1

getModelFunction · 0.70

Tested by

no test coverage detected