Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit 67e961e

Browse files
authored
Translate Automl samples (#131)
* initial translation commit * readme fix - check cloud link * first round style fixes * style fix 2 * Thanks Ace! * template path fix * Fix ENV variable for project Id (GCLOUD_PROJECT) * Translate AutoML samples * fixing lint issues * re-trigger tests
1 parent 1a58ea7 commit 67e961e

9 files changed

Lines changed: 1275 additions & 0 deletions

File tree

samples/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,142 @@ For more information, see https://cloud.google.com/translate/docs
6464

6565
[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
6666
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md
67+
68+
### automlTranslationDataset
69+
70+
View the [source code][automlTranslationDataset_code].
71+
72+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/automl/automlTranslationDataset.js,samples/README.md)
73+
74+
__Usage:__ `node automlTranslationDataset.js --help`
75+
76+
```
77+
automlTranslationDataset.js <command>
78+
79+
Commands:
80+
automlTranslationDataset.js create-dataset creates a new Dataset
81+
automlTranslationDataset.js list-datasets list all Datasets
82+
automlTranslationDataset.js get-dataset Get a Dataset
83+
automlTranslationDataset.js delete-dataset Delete a dataset
84+
automlTranslationDataset.js import-data Import labeled items into dataset
85+
86+
Options:
87+
--version Show version number [boolean]
88+
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
89+
--datasetName, -n Name of the Dataset [string] [default: "testDataSet"]
90+
--datasetId, -i Id of the dataset [string]
91+
--filter, -f Name of the Dataset to search for [string] [default: "translationDatasetMetadata:*"]
92+
--multilabel, -m Type of the classification problem, False - MULTICLASS, True - MULTILABEL.
93+
[string] [default: false]
94+
--outputUri, -o URI (or local path) to export dataset [string]
95+
--path, -p URI or local path to input .csv, or array of .csv paths
96+
[string] [default: "gs://nodejs-docs-samples-vcm/en-ja.csv"]
97+
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "nodejs-docs-samples"]
98+
--source, -s The source language to be translated from [string]
99+
--target, -t The target language to be translated to [string]
100+
--help Show help [boolean]
101+
102+
Examples:
103+
node automlTranslationDataset.js create-dataset -n "newDataSet" -s "en" -t "ja"
104+
node automlTranslationDataset.js list-datasets -f "translationDatasetMetadata:*"
105+
node automlTranslationDataset.js get-dataset -i "DATASETID"
106+
node automlTranslationDataset.js delete-dataset -i "DATASETID"
107+
node automlTranslationDataset.js import-data -i "dataSetId" -p "gs://myproject/mytraindata.csv"
108+
109+
For more information, see https://cloud.google.com/translate/docs
110+
```
111+
112+
[automlTranslationDataset_docs]: https://cloud.google.com/translate/docs
113+
[automlTranslationDataset_code]: automl/automlTranslationDataset.js
114+
115+
[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
116+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md
117+
118+
### automlTranslationModel
119+
120+
View the [source code][automlTranslationModel_code].
121+
122+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/automl/automlTranslationModel.js,samples/README.md)
123+
124+
__Usage:__ `node translate.js --help`
125+
126+
```
127+
automlTranslationModel.js <command>
128+
129+
Commands:
130+
automlTranslationModel.js create-model creates a new Model
131+
automlTranslationModel.js get-operation-status Gets status of current operation
132+
automlTranslationModel.js list-models list all Models
133+
automlTranslationModel.js get-model Get a Model
134+
automlTranslationModel.js list-model-evaluations List model evaluations
135+
automlTranslationModel.js get-model-evaluation Get model evaluation
136+
automlTranslationModel.js delete-model Delete a Model
137+
138+
Options:
139+
--version Show version number [boolean]
140+
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
141+
--datasetId, -i Id of the dataset [string]
142+
--filter, -f Name of the Dataset to search for [string] [default: ""]
143+
--modelName, -m Name of the model [string] [default: false]
144+
--modelId, -a Id of the model [string] [default: ""]
145+
--modelEvaluationId, -e Id of the model evaluation [string] [default: ""]
146+
--operationFullId, -o Full name of an operation [string] [default: ""]
147+
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "nodejs-docs-samples"]
148+
--help Show help [boolean]
149+
150+
Examples:
151+
node automlTranslationModel.js create-model -i "DatasetID" -m "myModelName"
152+
node automlTranslationModel.js get-operation-status -i "datasetId" -o "OperationFullID"
153+
node automlTranslationModel.js list-models -f "translationModelMetadata:*"
154+
node automlTranslationModel.js get-model -a "ModelID"
155+
node automlTranslationModel.js list-model-evaluations -a "ModelID"
156+
node automlTranslationModel.js get-model-evaluation -a "ModelId" -e "ModelEvaluationID"
157+
node automlTranslationModel.js delete-model -a "ModelID"
158+
159+
For more information, see https://cloud.google.com/translate/docs
160+
```
161+
162+
[automlTranslationModel_docs]: https://cloud.google.com/translate/docs
163+
[automlTranslationModel_code]: automl/automlTranslationModel.js
164+
165+
[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
166+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md
167+
168+
### automlTranslationPredict
169+
170+
View the [source code][automlTranslationPredict_code].
171+
172+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/automl/automlTranslationPredict.js,samples/README.md)
173+
174+
__Usage:__ `node translate.js --help`
175+
176+
```
177+
automlTranslationPredict.js <command>
178+
179+
Commands:
180+
automlTranslationPredict.js predict classify the content
181+
182+
Options:
183+
--version Show version number [boolean]
184+
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
185+
--filePath, -f local text file path of the content to be classified
186+
[string] [default: "./resources/testInput.txt"]
187+
--modelId, -i Id of the model which will be used for text classification [string]
188+
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "203278707824"]
189+
--translationAllowFallback, -t Use true if AutoML will fallback to use a Google translation model fortranslation
190+
requests if the specified AutoML translation model cannotserve the request. Use false
191+
to not use Google translation model. [string] [default: "False"]
192+
--help Show help [boolean]
193+
194+
Examples:
195+
node automlTranslationPredict.js predict -i "modelId" -f "./resources/testInput.txt" -t "False"
196+
197+
For more information, see https://cloud.google.com/translate/docs
198+
```
199+
200+
[automlTranslationPredict_docs]: https://cloud.google.com/translate/docs
201+
[automlTranslationPredict_code]: automl/automlTranslationPredict.js
202+
203+
[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
204+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md
205+

0 commit comments

Comments
 (0)