Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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