()
| 40 | const content = fs.readFileSync(filePath, 'utf8'); |
| 41 | |
| 42 | async function predict() { |
| 43 | // Construct request |
| 44 | const request = { |
| 45 | name: client.modelPath(projectId, location, modelId), |
| 46 | payload: { |
| 47 | textSnippet: { |
| 48 | content: content, |
| 49 | }, |
| 50 | }, |
| 51 | }; |
| 52 | |
| 53 | const [response] = await client.predict(request); |
| 54 | |
| 55 | console.log( |
| 56 | 'Translated content: ', |
| 57 | response.payload[0].translation.translatedContent.content |
| 58 | ); |
| 59 | } |
| 60 | |
| 61 | predict(); |
| 62 | // [END automl_translate_predict] |