@@ -28,10 +28,8 @@ async function main(text, endpointId, project, location) {
28
28
// const project = 'YOUR_PROJECT_ID';
29
29
// const location = 'YOUR_PROJECT_LOCATION';
30
30
const aiplatform = require ( '@google-cloud/aiplatform' ) ;
31
- const {
32
- instance,
33
- prediction,
34
- } = aiplatform . protos . google . cloud . aiplatform . v1 . schema . predict ;
31
+ const { instance, prediction} =
32
+ aiplatform . protos . google . cloud . aiplatform . v1 . schema . predict ;
35
33
36
34
// Imports the Google Cloud Model Service Client library
37
35
const { PredictionServiceClient} = aiplatform . v1 ;
@@ -48,11 +46,10 @@ async function main(text, endpointId, project, location) {
48
46
// Configure the resources
49
47
const endpoint = `projects/${ project } /locations/${ location } /endpoints/${ endpointId } ` ;
50
48
51
- const predictionInstance = new instance . TextClassificationPredictionInstance (
52
- {
49
+ const predictionInstance =
50
+ new instance . TextClassificationPredictionInstance ( {
53
51
content : text ,
54
- }
55
- ) ;
52
+ } ) ;
56
53
const instanceValue = predictionInstance . toValue ( ) ;
57
54
58
55
const instances = [ instanceValue ] ;
@@ -68,9 +65,10 @@ async function main(text, endpointId, project, location) {
68
65
console . log ( 'Prediction results:' ) ;
69
66
70
67
for ( const predictionResultValue of response . predictions ) {
71
- const predictionResult = prediction . ClassificationPredictionResult . fromValue (
72
- predictionResultValue
73
- ) ;
68
+ const predictionResult =
69
+ prediction . ClassificationPredictionResult . fromValue (
70
+ predictionResultValue
71
+ ) ;
74
72
75
73
for ( const [ i , label ] of predictionResult . displayNames . entries ( ) ) {
76
74
console . log ( `\tDisplay name: ${ label } ` ) ;
0 commit comments