Skip to content

Commit 5bb2b92

Browse files
tswastdpebot
authored andcommitted
vision: Got empty response when requests are gzipped. (#341)
1 parent c817c92 commit 5bb2b92

File tree

2 files changed

+3
-1
lines changed
  • vision
    • label/src/main/java/com/google/cloud/vision/samples/label
    • landmark-detection/src/main/java/com/google/cloud/vision/samples/landmarkdetection

2 files changed

+3
-1
lines changed

vision/label/src/main/java/com/google/cloud/vision/samples/label/LabelApp.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public List<EntityAnnotation> labelImage(Path path, int maxResults) throws IOExc
129129
vision.images()
130130
.annotate(new BatchAnnotateImagesRequest().setRequests(ImmutableList.of(request)));
131131
// Due to a bug: requests to Vision API containing large images fail when GZipped.
132-
// annotate.setDisableGZipContent(true);
132+
annotate.setDisableGZipContent(true);
133133
// [END construct_request]
134134

135135
// [START parse_response]

vision/landmark-detection/src/main/java/com/google/cloud/vision/samples/landmarkdetection/DetectLandmark.java

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ public List<EntityAnnotation> identifyLandmark(String uri, int maxResults) throw
115115
Vision.Images.Annotate annotate =
116116
vision.images()
117117
.annotate(new BatchAnnotateImagesRequest().setRequests(ImmutableList.of(request)));
118+
// Due to a bug: requests to Vision API containing large images fail when GZipped.
119+
annotate.setDisableGZipContent(true);
118120

119121
BatchAnnotateImagesResponse batchResponse = annotate.execute();
120122
assert batchResponse.getResponses().size() == 1;

0 commit comments

Comments
 (0)