Skip to content

Commit

Permalink
samples: samples:added docs links to predict samples (#3266)
Browse files Browse the repository at this point in the history
Fixes #1730
  • Loading branch information
munkhuushmgl authored and chingor13 committed Aug 3, 2020
1 parent 4624473 commit 7966012
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ static void predict(String projectId, String modelId, String content) throws IOE
try (PredictionServiceClient client = PredictionServiceClient.create()) {
// Get the full path of the model.
ModelName name = ModelName.of(projectId, "us-central1", modelId);

// For available mime types, see:
// https://cloud.google.com/automl/docs/reference/rest/v1/projects.locations.models/predict#textsnippet
TextSnippet textSnippet =
TextSnippet.newBuilder().setContent(content).setMimeType("text/plain").build();
TextSnippet.newBuilder()
.setContent(content)
.setMimeType("text/plain") // Types: text/plain, text/html
.build();
ExamplePayload payload = ExamplePayload.newBuilder().setTextSnippet(textSnippet).build();
PredictRequest predictRequest =
PredictRequest.newBuilder().setName(name.toString()).setPayload(payload).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ static void predict(String projectId, String modelId, String content) throws IOE
try (PredictionServiceClient client = PredictionServiceClient.create()) {
// Get the full path of the model.
ModelName name = ModelName.of(projectId, "us-central1", modelId);

// For available mime types, see:
// https://cloud.google.com/automl/docs/reference/rest/v1/projects.locations.models/predict#textsnippet
TextSnippet textSnippet =
TextSnippet.newBuilder()
.setContent(content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ static void predict(String projectId, String modelId, String content) throws IOE
try (PredictionServiceClient client = PredictionServiceClient.create()) {
// Get the full path of the model.
ModelName name = ModelName.of(projectId, "us-central1", modelId);

// For available mime types, see:
// https://cloud.google.com/automl/docs/reference/rest/v1/projects.locations.models/predict#textsnippet
TextSnippet textSnippet =
TextSnippet.newBuilder()
.setContent(content)
Expand Down

0 comments on commit 7966012

Please sign in to comment.