Skip to content

Commit 8cc8e35

Browse files
nirupa-kumarnnegrey
authored andcommitted
Automl (#1158)
* Test push * Vision AutoML * Vision AutoML updates + Translate AutoML * Translate README fixes * Fixing Kokoro failure issue * Language AutoML * Vision AutoML * Translate AutoML files added * Triggering tests * Triggering tests
1 parent fa1cf66 commit 8cc8e35

File tree

27 files changed

+4143
-0
lines changed

27 files changed

+4143
-0
lines changed

language/automl/README.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# AutoML Sample
2+
3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=vision/beta/cloud-client/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
6+
[Google Cloud Natural Language API][language] provides feature detection for images.
7+
This API is part of the larger collection of Cloud Machine Learning APIs.
8+
9+
This sample Java application demonstrates how to access the Cloud Natural Language AutoML API
10+
using the [Google Cloud Client Library for Java][google-cloud-java].
11+
12+
[language]: https://cloud.google.com/language/docs/
13+
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java
14+
15+
## Set the environment variables
16+
17+
PROJECT_ID = [Id of the project]
18+
REGION_NAME = [Region name]
19+
20+
## Build the sample
21+
22+
Install [Maven](http://maven.apache.org/).
23+
24+
Build your project with:
25+
26+
```
27+
mvn clean package
28+
```
29+
30+
### Dataset API
31+
32+
#### Create a new dataset
33+
```
34+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.DatasetApi" -Dexec.args="create_dataset test_dataset"
35+
```
36+
37+
#### List datasets
38+
```
39+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.DatasetApi" -Dexec.args="list_datasets"
40+
```
41+
42+
#### Get dataset
43+
```
44+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.DatasetApi" -Dexec.args="get_dataset [dataset-id]"
45+
```
46+
47+
#### Import data
48+
```
49+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.DatasetApi" -Dexec.args="import_data gs://java-docs-samples-testing/happiness.csv"
50+
```
51+
52+
### Model API
53+
54+
#### Create Model
55+
```
56+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.ModelApi" -Dexec.args="create_model test_model"
57+
```
58+
59+
#### List Models
60+
```
61+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.ModelApi" -Dexec.args="list_models"
62+
```
63+
64+
#### Get Model
65+
```
66+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.ModelApi" -Dexec.args="get_model [model-id]"
67+
```
68+
69+
#### List Model Evaluations
70+
```
71+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.ModelApi" -Dexec.args="list_model_evaluation [model-id]"
72+
```
73+
74+
#### Get Model Evaluation
75+
```
76+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.ModelApi" -Dexec.args="get_model_evaluation [model-id] [model-evaluation-id]"
77+
```
78+
79+
#### Delete Model
80+
```
81+
mvn exec:java-Dexec.mainClass="com.google.cloud.language.samples.ModelApi" -Dexec.args="delete_model [model-id]"
82+
```
83+
### Predict API
84+
85+
```
86+
mvn exec:java -Dexec.mainClass="com.google.cloud.language.samples.PredictApi" -Dexec.args="predict [model-id] ./resources/input.txt"
87+
```
88+

language/automl/pom.xml

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
<!--
2+
Copyright 2018 Google LLC.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<project>
17+
<modelVersion>4.0.0</modelVersion>
18+
<groupId>com.example.vision</groupId>
19+
<artifactId>language-automl</artifactId>
20+
<packaging>jar</packaging>
21+
22+
<!--
23+
The parent pom defines common style checks and testing strategies for our samples.
24+
Removing or replacing it should not affect the execution of the samples in anyway.
25+
-->
26+
<parent>
27+
<groupId>com.google.cloud.samples</groupId>
28+
<artifactId>shared-configuration</artifactId>
29+
<version>1.0.9</version>
30+
</parent>
31+
32+
<properties>
33+
<maven.compiler.target>1.8</maven.compiler.target>
34+
<maven.compiler.source>1.8</maven.compiler.source>
35+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36+
</properties>
37+
38+
<dependencies>
39+
<!-- [START dependencies] -->
40+
<dependency>
41+
<groupId>com.google.cloud</groupId>
42+
<artifactId>google-cloud-automl</artifactId>
43+
<version>0.55.1-beta</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>net.sourceforge.argparse4j</groupId>
47+
<artifactId>argparse4j</artifactId>
48+
<version>0.8.1</version>
49+
</dependency>
50+
<!-- [END dependencies] -->
51+
52+
<!-- Test dependencies -->
53+
<dependency>
54+
<groupId>junit</groupId>
55+
<artifactId>junit</artifactId>
56+
<version>4.12</version>
57+
<scope>test</scope>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>com.google.truth</groupId>
62+
<artifactId>truth</artifactId>
63+
<version>0.41</version>
64+
<scope>test</scope>
65+
</dependency>
66+
</dependencies>
67+
68+
<profiles>
69+
<profile>
70+
<id>DatasetApi</id>
71+
<activation>
72+
<property>
73+
<name>DatasetApi</name>
74+
</property>
75+
</activation>
76+
<build>
77+
<plugins>
78+
<plugin>
79+
<groupId>org.codehaus.mojo</groupId>
80+
<artifactId>exec-maven-plugin</artifactId>
81+
<version>1.6.0</version>
82+
<executions>
83+
<execution>
84+
<goals>
85+
<goal>java</goal>
86+
</goals>
87+
</execution>
88+
</executions>
89+
<configuration>
90+
<mainClass>com.google.cloud.language.samples.DatasetApi</mainClass>
91+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
92+
</configuration>
93+
</plugin>
94+
</plugins>
95+
</build>
96+
</profile>
97+
<profile>
98+
<id>ModelApi</id>
99+
<activation>
100+
<property>
101+
<name>ModelApi</name>
102+
</property>
103+
</activation>
104+
<build>
105+
<plugins>
106+
<plugin>
107+
<groupId>org.codehaus.mojo</groupId>
108+
<artifactId>exec-maven-plugin</artifactId>
109+
<version>1.6.0</version>
110+
<executions>
111+
<execution>
112+
<goals>
113+
<goal>java</goal>
114+
</goals>
115+
</execution>
116+
</executions>
117+
<configuration>
118+
<mainClass>com.google.cloud.language.samples.ModelApi</mainClass>
119+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
120+
</configuration>
121+
</plugin>
122+
</plugins>
123+
</build>
124+
</profile>
125+
<profile>
126+
<id>PredictApi</id>
127+
<activation>
128+
<property>
129+
<name>PredictApi</name>
130+
</property>
131+
</activation>
132+
<build>
133+
<plugins>
134+
<plugin>
135+
<groupId>org.codehaus.mojo</groupId>
136+
<artifactId>exec-maven-plugin</artifactId>
137+
<version>1.6.0</version>
138+
<executions>
139+
<execution>
140+
<goals>
141+
<goal>java</goal>
142+
</goals>
143+
</execution>
144+
</executions>
145+
<configuration>
146+
<mainClass>com.google.cloud.language.samples.PredictionApi</mainClass>
147+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
148+
</configuration>
149+
</plugin>
150+
</plugins>
151+
</build>
152+
</profile>
153+
</profiles>
154+
</project>

language/automl/resources/input.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
creamy, full-flavored, nutty, sweet

0 commit comments

Comments
 (0)