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

Function uploadModel

ai-platform/snippets/upload-model.js:49–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 const modelServiceClient = new ModelServiceClient(clientOptions);
48
49 async function uploadModel() {
50 // Configure the parent resources
51 const parent = `projects/${project}/locations/${location}`;
52 // Configure the model resources
53 const model = {
54 displayName: modelDisplayName,
55 metadataSchemaUri: '',
56 artifactUri: artifactUri,
57 containerSpec: {
58 imageUri: imageUri,
59 command: [],
60 args: [],
61 env: [],
62 ports: [],
63 predictRoute: '',
64 healthRoute: '',
65 },
66 };
67 const request = {
68 parent,
69 model,
70 };
71
72 console.log('PARENT AND MODEL');
73 console.log(parent, model);
74 // Upload Model request
75 const [response] = await modelServiceClient.uploadModel(request);
76 console.log(`Long running operation : ${response.name}`);
77
78 // Wait for operation to complete
79 await response.promise();
80 const result = response.result;
81
82 console.log('Upload model response ');
83 console.log(`\tModel : ${result.model}`);
84 }
85 uploadModel();
86 // [END aiplatform_upload_model_sample]
87}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected