Skip to content

Commit

Permalink
Merge branch 'master' into automl
Browse files Browse the repository at this point in the history
  • Loading branch information
nirupa-kumar authored Jul 30, 2018
2 parents 3c09412 + 7ef8b81 commit d6b926f
Show file tree
Hide file tree
Showing 17 changed files with 1,602 additions and 1 deletion.
3 changes: 3 additions & 0 deletions language/automl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
<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">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>


[Google Cloud AutoML Natural Language API][language] provides feature detection for images.

This API is part of the larger collection of Cloud Machine Learning APIs.

This sample Java application demonstrates how to access the Cloud Natural Language AutoML API
using the [Google Cloud Client Library for Java][google-cloud-java].


[language]: https://cloud.google.com/language/automl/docs/
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java

Expand Down
3 changes: 3 additions & 0 deletions translate/automl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
<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">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>


[Google Cloud AutoML Translation API][translate] provides feature AutoML.

This API is part of the larger collection of Cloud Machine Learning APIs.

This sample Java application demonstrates how to access the Cloud Translate AutoML API
using the [Google Cloud Client Library for Java][google-cloud-java].


[translate]: https://cloud.google.com/translate/automl/docs/
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class PredictionApi {
*/
public static void predict(
String projectId, String computeRegion, String modelId, String filePath) throws IOException {

// Instantiate client for prediction service.
PredictionServiceClient predictionClient = PredictionServiceClient.create();

Expand Down Expand Up @@ -100,6 +101,7 @@ public static void argsHelper(String[] args, PrintStream out) throws IOException
.build()
.defaultHelp(true)
.description("Prediction API Operation");

Subparsers subparsers = parser.addSubparsers().dest("command");

Subparser predictParser = subparsers.addParser("predict");
Expand All @@ -114,6 +116,7 @@ public static void argsHelper(String[] args, PrintStream out) throws IOException
ns = parser.parseArgs(args);
if (ns.get("command").equals("predict")) {
predict(projectId, computeRegion, ns.getString("modelId"), ns.getString("filePath"));

}
} catch (ArgumentParserException e) {
parser.handleError(e);
Expand Down
2 changes: 1 addition & 1 deletion video/beta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-video-intelligence</artifactId>
<version>0.52.0-beta</version>
<version>0.55.1-beta</version>
</dependency>
<!-- [END dependencies] -->

Expand Down
1 change: 1 addition & 0 deletions video/beta/src/main/java/com/example/video/Detect.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public static void speechTranscription(String gcsUri) throws Exception {
// Set the language code
SpeechTranscriptionConfig config = SpeechTranscriptionConfig.newBuilder()
.setLanguageCode("en-US")
.setEnableAutomaticPunctuation(true)
.build();

// Set the video context with the above configuration
Expand Down
2 changes: 2 additions & 0 deletions vision/automl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[Google Cloud AutoML Vision API][vision] provides feature detection for images.

This API is part of the larger collection of Cloud Machine Learning APIs.

This sample Java application demonstrates how to access the Cloud Vision API
using the [Google Cloud Client Library for Java][google-cloud-java].


[vision]: https://cloud.google.com/vision/automl/docs/
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java

Expand Down
248 changes: 248 additions & 0 deletions vision/product-search/cloud-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
<!--
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.vision</groupId>
<artifactId>vision-detect-product-search</artifactId>
<packaging>jar</packaging>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.9</version>
</parent>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- [START dependencies] -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-vision</artifactId>
<version>1.37.1</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.37.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.argparse4j</groupId>
<artifactId>argparse4j</artifactId>
<version>0.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.5</version>
</dependency>
<!-- [END dependencies] -->

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>0.40</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>ImportProductSets</id>
<activation>
<property>
<name>ImportProductSets</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.vision.ImportProductSets</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ProductInProductSetManagement</id>
<activation>
<property>
<name>ProductInProductSetManagement</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.vision.ProductInProductSetManagement</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ProductManagement</id>
<activation>
<property>
<name>ProductManagement</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.vision.ProductManagement</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ProductSearch</id>
<activation>
<property>
<name>ProductSearch</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.vision.ProductSearch</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ProductSetManagement</id>
<activation>
<property>
<name>ProductSetManagement</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.vision.ProductSetManagement</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ReferenceImageManagement</id>
<activation>
<property>
<name>ReferenceImageManagement</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.vision.ReferenceImageManagement</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"gs://java-docs-samples-testing/product-search/shoes_1.jpg","indexed_product_set_id_for_testing","indexed_product_id_for_testing_1","apparel","style=womens","0.1,0.1,0.9,0.1,0.9,0.9,0.1,0.9"
"gs://java-docs-samples-testing/product-search/shoes_2.jpg","indexed_product_set_id_for_testing","indexed_product_id_for_testing_2","apparel",,
2 changes: 2 additions & 0 deletions vision/product-search/cloud-client/resources/product_sets.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"gs://java-docs-samples-testing/product-search/shoes_1.jpg","fake_product_set_id_for_testing","fake_product_id_for_testing_1","apparel","style=womens","0.1,0.1,0.9,0.1,0.9,0.9,0.1,0.9"
"gs://java-docs-samples-testing/product-search/shoes_2.jpg","fake_product_set_id_for_testing","fake_product_id_for_testing_2","apparel",,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d6b926f

Please sign in to comment.