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

Function predict

automl/translate_predict.js:42–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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]

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected