| 38 | const client = new PredictionServiceClient(); |
| 39 | |
| 40 | async function batchPredict() { |
| 41 | // Construct request |
| 42 | const request = { |
| 43 | name: client.modelPath(projectId, location, modelId), |
| 44 | inputConfig: { |
| 45 | gcsSource: { |
| 46 | inputUris: [inputUri], |
| 47 | }, |
| 48 | }, |
| 49 | outputConfig: { |
| 50 | gcsDestination: { |
| 51 | outputUriPrefix: outputUri, |
| 52 | }, |
| 53 | }, |
| 54 | }; |
| 55 | |
| 56 | const [operation] = await client.batchPredict(request); |
| 57 | |
| 58 | console.log('Waiting for operation to complete...'); |
| 59 | // Wait for operation to complete. |
| 60 | const [response] = await operation.promise(); |
| 61 | console.log( |
| 62 | `Batch Prediction results saved to Cloud Storage bucket. ${response}` |
| 63 | ); |
| 64 | } |
| 65 | |
| 66 | batchPredict(); |
| 67 | // [END automl_batch_predict] |