google-cloud-vision 0.32.3 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3e9260f0687fddb06b98ef2fe53379c06b0a3698c0c9f822c058371a63883a0
4
- data.tar.gz: 22eb45350bd0589357f5d60f6282733f6acd844b56d683da727d4b4d4fc138c0
3
+ metadata.gz: e31522f0adb0650f2c73109c462977801780eedd5f3dd7edfa9ee79f92cb0763
4
+ data.tar.gz: f24cbb9a8dad4cdf92369eac010fbd6078521ef0e7aa972ac224d9b7bb6f2bd2
5
5
  SHA512:
6
- metadata.gz: 62cd25a84e43db4b7fa3faa122400fd1d22f4e8782562cae2950c3e75dcaae73bd6f604259364cfe58d57a7f81ca317fe4434059fad89eaf384ee5777fcd1dd4
7
- data.tar.gz: 8f8318a452e72f504726e4e7b1c9cf5fb41f98a2f582e89f32c65c5371117cd97b87a2de0e38d48c8ac214ea6e8a778ceba75415ac06598e6a8e0e471cc4197d
6
+ metadata.gz: 30ee67610b93fb9934ae28e233940882305a8ed366985c61aa1d994b20ab45597cc02931c842f6c8aa3ccb88d522915c97ff2ab79fa5ec300c2822003e990054
7
+ data.tar.gz: 1f007dd051c4aab4414e9790f16238eee6fffced7029b8bd0d1aafb34e004d2b257b42e29d97044d9cb2c105df3fadb3c85fb134acc8c06b8a9ed4b59424552f
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Ruby Client for Cloud Vision API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
2
2
 
3
3
  [Cloud Vision API][Product Documentation]:
4
- Integrates Google Vision features, including image labeling, face, logo, and
5
- landmark detection, optical character recognition (OCR), and detection of
6
- explicit content, into applications.
4
+ Integrates Google Vision features, including image labeling, face, logo,
5
+ and landmark detection, optical character recognition (OCR), and detection
6
+ of explicit content, into applications.
7
7
  - [Client Library Documentation][]
8
8
  - [Product Documentation][]
9
9
 
@@ -24,9 +24,9 @@ module Google
24
24
  # # Ruby Client for Cloud Vision API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
25
25
  #
26
26
  # [Cloud Vision API][Product Documentation]:
27
- # Integrates Google Vision features, including image labeling, face, logo, and
28
- # landmark detection, optical character recognition (OCR), and detection of
29
- # explicit content, into applications.
27
+ # Integrates Google Vision features, including image labeling, face, logo,
28
+ # and landmark detection, optical character recognition (OCR), and detection
29
+ # of explicit content, into applications.
30
30
  # - [Product Documentation][]
31
31
  #
32
32
  # ## Quick Start
@@ -112,24 +112,11 @@ module Google
112
112
  .select { |dir| File.exist?(dir + ".rb") }
113
113
  .map { |dir| File.basename(dir) }
114
114
 
115
- module ProductSearch
115
+ module ImageAnnotator
116
116
  ##
117
- # Manages Products and ProductSets of reference images for use in product
118
- # search. It uses the following resource model:
119
- #
120
- # * The API has a collection of {Google::Cloud::Vision::V1::ProductSet ProductSet}
121
- # resources, named `projects/*/locations/*/productSets/*`, which acts as a way
122
- # to put different products into groups to limit identification.
123
- #
124
- # In parallel,
125
- #
126
- # * The API has a collection of {Google::Cloud::Vision::V1::Product Product}
127
- # resources, named
128
- # `projects/*/locations/*/products/*`
129
- #
130
- # * Each {Google::Cloud::Vision::V1::Product Product} has a collection of
131
- # {Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
132
- # `projects/*/locations/*/products/*/referenceImages/*`
117
+ # Service that performs Google Cloud Vision API detection tasks over client
118
+ # images, such as face, landmark, logo, label, and text detection. The
119
+ # ImageAnnotator service returns detected entities from the images.
133
120
  #
134
121
  # @param version [Symbol, String]
135
122
  # The major version of the service to be used. By default :v1
@@ -175,15 +162,28 @@ module Google
175
162
  .constants
176
163
  .select {|sym| sym.to_s.downcase == version.to_s.downcase}
177
164
  .first
178
- Google::Cloud::Vision.const_get(version_module)::ProductSearch.new(*args, **kwargs)
165
+ Google::Cloud::Vision.const_get(version_module)::ImageAnnotator.new(*args, **kwargs)
179
166
  end
180
167
  end
181
168
 
182
- module ImageAnnotator
169
+ module ProductSearch
183
170
  ##
184
- # Service that performs Google Cloud Vision API detection tasks over client
185
- # images, such as face, landmark, logo, label, and text detection. The
186
- # ImageAnnotator service returns detected entities from the images.
171
+ # Manages Products and ProductSets of reference images for use in product
172
+ # search. It uses the following resource model:
173
+ #
174
+ # * The API has a collection of {Google::Cloud::Vision::V1::ProductSet ProductSet}
175
+ # resources, named `projects/*/locations/*/productSets/*`, which acts as a way
176
+ # to put different products into groups to limit identification.
177
+ #
178
+ # In parallel,
179
+ #
180
+ # * The API has a collection of {Google::Cloud::Vision::V1::Product Product}
181
+ # resources, named
182
+ # `projects/*/locations/*/products/*`
183
+ #
184
+ # * Each {Google::Cloud::Vision::V1::Product Product} has a collection of
185
+ # {Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
186
+ # `projects/*/locations/*/products/*/referenceImages/*`
187
187
  #
188
188
  # @param version [Symbol, String]
189
189
  # The major version of the service to be used. By default :v1
@@ -229,7 +229,7 @@ module Google
229
229
  .constants
230
230
  .select {|sym| sym.to_s.downcase == version.to_s.downcase}
231
231
  .first
232
- Google::Cloud::Vision.const_get(version_module)::ImageAnnotator.new(*args, **kwargs)
232
+ Google::Cloud::Vision.const_get(version_module)::ProductSearch.new(*args, **kwargs)
233
233
  end
234
234
  end
235
235
  end
@@ -13,9 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/vision/v1/product_search_client"
17
16
  require "google/cloud/vision/v1/image_annotator_client"
18
17
  require "google/cloud/vision/v1/helpers"
18
+ require "google/cloud/vision/v1/product_search_client"
19
19
  require "google/cloud/vision/v1/product_search_service_pb"
20
20
  require "google/cloud/vision/v1/image_annotator_pb"
21
21
 
@@ -28,9 +28,9 @@ module Google
28
28
  # # Ruby Client for Cloud Vision API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
29
29
  #
30
30
  # [Cloud Vision API][Product Documentation]:
31
- # Integrates Google Vision features, including image labeling, face, logo, and
32
- # landmark detection, optical character recognition (OCR), and detection of
33
- # explicit content, into applications.
31
+ # Integrates Google Vision features, including image labeling, face, logo,
32
+ # and landmark detection, optical character recognition (OCR), and detection
33
+ # of explicit content, into applications.
34
34
  # - [Product Documentation][]
35
35
  #
36
36
  # ## Quick Start
@@ -101,24 +101,11 @@ module Google
101
101
  module V1
102
102
  # rubocop:enable LineLength
103
103
 
104
- module ProductSearch
104
+ module ImageAnnotator
105
105
  ##
106
- # Manages Products and ProductSets of reference images for use in product
107
- # search. It uses the following resource model:
108
- #
109
- # * The API has a collection of {Google::Cloud::Vision::V1::ProductSet ProductSet}
110
- # resources, named `projects/*/locations/*/productSets/*`, which acts as a way
111
- # to put different products into groups to limit identification.
112
- #
113
- # In parallel,
114
- #
115
- # * The API has a collection of {Google::Cloud::Vision::V1::Product Product}
116
- # resources, named
117
- # `projects/*/locations/*/products/*`
118
- #
119
- # * Each {Google::Cloud::Vision::V1::Product Product} has a collection of
120
- # {Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
121
- # `projects/*/locations/*/products/*/referenceImages/*`
106
+ # Service that performs Google Cloud Vision API detection tasks over client
107
+ # images, such as face, landmark, logo, label, and text detection. The
108
+ # ImageAnnotator service returns detected entities from the images.
122
109
  #
123
110
  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
124
111
  # Provides the means for authenticating requests made by the client. This parameter can
@@ -168,15 +155,28 @@ module Google
168
155
  lib_name: lib_name,
169
156
  lib_version: lib_version
170
157
  }.select { |_, v| v != nil }
171
- Google::Cloud::Vision::V1::ProductSearchClient.new(**kwargs)
158
+ Google::Cloud::Vision::V1::ImageAnnotatorClient.new(**kwargs)
172
159
  end
173
160
  end
174
161
 
175
- module ImageAnnotator
162
+ module ProductSearch
176
163
  ##
177
- # Service that performs Google Cloud Vision API detection tasks over client
178
- # images, such as face, landmark, logo, label, and text detection. The
179
- # ImageAnnotator service returns detected entities from the images.
164
+ # Manages Products and ProductSets of reference images for use in product
165
+ # search. It uses the following resource model:
166
+ #
167
+ # * The API has a collection of {Google::Cloud::Vision::V1::ProductSet ProductSet}
168
+ # resources, named `projects/*/locations/*/productSets/*`, which acts as a way
169
+ # to put different products into groups to limit identification.
170
+ #
171
+ # In parallel,
172
+ #
173
+ # * The API has a collection of {Google::Cloud::Vision::V1::Product Product}
174
+ # resources, named
175
+ # `projects/*/locations/*/products/*`
176
+ #
177
+ # * Each {Google::Cloud::Vision::V1::Product Product} has a collection of
178
+ # {Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
179
+ # `projects/*/locations/*/products/*/referenceImages/*`
180
180
  #
181
181
  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
182
182
  # Provides the means for authenticating requests made by the client. This parameter can
@@ -226,7 +226,7 @@ module Google
226
226
  lib_name: lib_name,
227
227
  lib_version: lib_version
228
228
  }.select { |_, v| v != nil }
229
- Google::Cloud::Vision::V1::ImageAnnotatorClient.new(**kwargs)
229
+ Google::Cloud::Vision::V1::ProductSearchClient.new(**kwargs)
230
230
  end
231
231
  end
232
232
  end
@@ -128,7 +128,7 @@ module Google
128
128
  # @!attribute [rw] bounding_poly
129
129
  # @return [Google::Cloud::Vision::V1::BoundingPoly]
130
130
  # The bounding polygon around the face. The coordinates of the bounding box
131
- # are in the original image's scale, as returned in `ImageParams`.
131
+ # are in the original image's scale.
132
132
  # The bounding box is computed to "frame" the face in accordance with human
133
133
  # expectations. It is based on the landmarker results.
134
134
  # Note that one or more x and/or y coordinates may not be generated in the
@@ -459,7 +459,7 @@ module Google
459
459
  # @!attribute [rw] bounding_poly
460
460
  # @return [Google::Cloud::Vision::V1::BoundingPoly]
461
461
  # The bounding polygon for the crop region. The coordinates of the bounding
462
- # box are in the original image's scale, as returned in `ImageParams`.
462
+ # box are in the original image's scale.
463
463
  # @!attribute [rw] confidence
464
464
  # @return [Float]
465
465
  # Confidence of this being a salient region. Range [0, 1].
@@ -518,7 +518,7 @@ module Google
518
518
  class ImageContext; end
519
519
 
520
520
  # Request for performing Google Cloud Vision API tasks over a user-provided
521
- # image, with user-requested features.
521
+ # image, with user-requested features, and with context information.
522
522
  # @!attribute [rw] image
523
523
  # @return [Google::Cloud::Vision::V1::Image]
524
524
  # The image to be processed.
@@ -601,6 +601,9 @@ module Google
601
601
  # @!attribute [rw] responses
602
602
  # @return [Array<Google::Cloud::Vision::V1::AnnotateImageResponse>]
603
603
  # Individual responses to images found within the file.
604
+ # @!attribute [rw] total_pages
605
+ # @return [Integer]
606
+ # This field gives the total number of pages in the file.
604
607
  class AnnotateFileResponse; end
605
608
 
606
609
  # Multiple image annotation requests are batched into a single service call.
@@ -615,6 +618,48 @@ module Google
615
618
  # Individual responses to image annotation requests within the batch.
616
619
  class BatchAnnotateImagesResponse; end
617
620
 
621
+ # A request to annotate one single file, e.g. a PDF, TIFF or GIF file.
622
+ # @!attribute [rw] input_config
623
+ # @return [Google::Cloud::Vision::V1::InputConfig]
624
+ # Required. Information about the input file.
625
+ # @!attribute [rw] features
626
+ # @return [Array<Google::Cloud::Vision::V1::Feature>]
627
+ # Required. Requested features.
628
+ # @!attribute [rw] image_context
629
+ # @return [Google::Cloud::Vision::V1::ImageContext]
630
+ # Additional context that may accompany the image(s) in the file.
631
+ # @!attribute [rw] pages
632
+ # @return [Array<Integer>]
633
+ # Pages of the file to perform image annotation.
634
+ #
635
+ # Pages starts from 1, we assume the first page of the file is page 1.
636
+ # At most 5 pages are supported per request. Pages can be negative.
637
+ #
638
+ # Page 1 means the first page.
639
+ # Page 2 means the second page.
640
+ # Page -1 means the last page.
641
+ # Page -2 means the second to the last page.
642
+ #
643
+ # If the file is GIF instead of PDF or TIFF, page refers to GIF frames.
644
+ #
645
+ # If this field is empty, by default the service performs image annotation
646
+ # for the first 5 pages of the file.
647
+ class AnnotateFileRequest; end
648
+
649
+ # A list of requests to annotate files using the BatchAnnotateFiles API.
650
+ # @!attribute [rw] requests
651
+ # @return [Array<Google::Cloud::Vision::V1::AnnotateFileRequest>]
652
+ # The list of file annotation requests. Right now we support only one
653
+ # AnnotateFileRequest in BatchAnnotateFilesRequest.
654
+ class BatchAnnotateFilesRequest; end
655
+
656
+ # A list of file annotation responses.
657
+ # @!attribute [rw] responses
658
+ # @return [Array<Google::Cloud::Vision::V1::AnnotateFileResponse>]
659
+ # The list of file annotation responses, each response corresponding to each
660
+ # AnnotateFileRequest in BatchAnnotateFilesRequest.
661
+ class BatchAnnotateFilesResponse; end
662
+
618
663
  # An offline file annotation request.
619
664
  # @!attribute [rw] input_config
620
665
  # @return [Google::Cloud::Vision::V1::InputConfig]
@@ -636,6 +681,21 @@ module Google
636
681
  # The output location and metadata from AsyncAnnotateFileRequest.
637
682
  class AsyncAnnotateFileResponse; end
638
683
 
684
+ # Request for async image annotation for a list of images.
685
+ # @!attribute [rw] requests
686
+ # @return [Array<Google::Cloud::Vision::V1::AnnotateImageRequest>]
687
+ # Individual image annotation requests for this batch.
688
+ # @!attribute [rw] output_config
689
+ # @return [Google::Cloud::Vision::V1::OutputConfig]
690
+ # Required. The desired output location and metadata (e.g. format).
691
+ class AsyncBatchAnnotateImagesRequest; end
692
+
693
+ # Response to an async batch image annotation request.
694
+ # @!attribute [rw] output_config
695
+ # @return [Google::Cloud::Vision::V1::OutputConfig]
696
+ # The output location and metadata from AsyncBatchAnnotateImagesRequest.
697
+ class AsyncBatchAnnotateImagesResponse; end
698
+
639
699
  # Multiple async file annotation requests are batched into a single service
640
700
  # call.
641
701
  # @!attribute [rw] requests
@@ -654,6 +714,14 @@ module Google
654
714
  # @!attribute [rw] gcs_source
655
715
  # @return [Google::Cloud::Vision::V1::GcsSource]
656
716
  # The Google Cloud Storage location to read the input from.
717
+ # @!attribute [rw] content
718
+ # @return [String]
719
+ # File content, represented as a stream of bytes.
720
+ # Note: As with all `bytes` fields, protobuffers use a pure binary
721
+ # representation, whereas JSON representations use base64.
722
+ #
723
+ # Currently, this field only works for BatchAnnotateFiles requests. It does
724
+ # not work for AsyncBatchAnnotateFiles requests.
657
725
  # @!attribute [rw] mime_type
658
726
  # @return [String]
659
727
  # The type of the file. Currently only "application/pdf" and "image/tiff"
@@ -689,16 +757,23 @@ module Google
689
757
  # The Google Cloud Storage location where the output will be written to.
690
758
  # @!attribute [rw] uri
691
759
  # @return [String]
692
- # Google Cloud Storage URI where the results will be stored. Results will
693
- # be in JSON format and preceded by its corresponding input URI. This field
694
- # can either represent a single file, or a prefix for multiple outputs.
695
- # Prefixes must end in a `/`.
760
+ # Google Cloud Storage URI prefix where the results will be stored. Results
761
+ # will be in JSON format and preceded by its corresponding input URI prefix.
762
+ # This field can either represent a gcs file prefix or gcs directory. In
763
+ # either case, the uri should be unique because in order to get all of the
764
+ # output files, you will need to do a wildcard gcs search on the uri prefix
765
+ # you provide.
696
766
  #
697
767
  # Examples:
698
768
  #
699
- # * File: gs://bucket-name/filename.json
700
- # * Prefix: gs://bucket-name/prefix/here/
701
- # * File: gs://bucket-name/prefix/here
769
+ # * File Prefix: gs://bucket-name/here/filenameprefix The output files
770
+ # will be created in gs://bucket-name/here/ and the names of the
771
+ # output files will begin with "filenameprefix".
772
+ #
773
+ # * Directory Prefix: gs://bucket-name/some/location/ The output files
774
+ # will be created in gs://bucket-name/some/location/ and the names of the
775
+ # output files could be anything because there was no filename prefix
776
+ # specified.
702
777
  #
703
778
  # If multiple outputs, each response is still AnnotateFileResponse, each of
704
779
  # which contains some subset of the full list of AnnotateImageResponse.
@@ -38,17 +38,20 @@ module Google
38
38
  # @return [String]
39
39
  # The filtering expression. This can be used to restrict search results based
40
40
  # on Product labels. We currently support an AND of OR of key-value
41
- # expressions, where each expression within an OR must have the same key.
41
+ # expressions, where each expression within an OR must have the same key. An
42
+ # '=' should be used to connect the key and value.
42
43
  #
43
44
  # For example, "(color = red OR color = blue) AND brand = Google" is
44
- # acceptable, but not "(color = red OR brand = Google)" or "color: red".
45
+ # acceptable, but "(color = red OR brand = Google)" is not acceptable.
46
+ # "color: red" is not acceptable because it uses a ':' instead of an '='.
45
47
  class ProductSearchParams; end
46
48
 
47
49
  # Results for a product search request.
48
50
  # @!attribute [rw] index_time
49
51
  # @return [Google::Protobuf::Timestamp]
50
- # Timestamp of the index which provided these results. Changes made after
51
- # this time are not reflected in the current results.
52
+ # Timestamp of the index which provided these results. Products added to the
53
+ # product set and products removed from the product set after this time are
54
+ # not reflected in the current results.
52
55
  # @!attribute [rw] results
53
56
  # @return [Array<Google::Cloud::Vision::V1::ProductSearchResults::Result>]
54
57
  # List of results, one for each product match.
@@ -83,7 +83,8 @@ module Google
83
83
  # @return [Google::Protobuf::Timestamp]
84
84
  # Output only. The time at which this ProductSet was last indexed. Query
85
85
  # results will reflect all updates before this time. If this ProductSet has
86
- # never been indexed, this field is 0.
86
+ # never been indexed, this timestamp is the default value
87
+ # "1970-01-01T00:00:00Z".
87
88
  #
88
89
  # This field is ignored when creating a ProductSet.
89
90
  # @!attribute [rw] index_error
@@ -63,6 +63,17 @@ module Google
63
63
  # (Deprecated) Overall relevancy score for the image.
64
64
  class WebImage; end
65
65
 
66
+ # Label to provide extra metadata for the web detection.
67
+ # @!attribute [rw] label
68
+ # @return [String]
69
+ # Label for extra metadata.
70
+ # @!attribute [rw] language_code
71
+ # @return [String]
72
+ # The BCP-47 language code for `label`, such as "en-US" or "sr-Latn".
73
+ # For more information, see
74
+ # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
75
+ class WebLabel; end
76
+
66
77
  # Metadata for web pages.
67
78
  # @!attribute [rw] url
68
79
  # @return [String]
@@ -84,17 +95,6 @@ module Google
84
95
  # example an original image will likely have partial matching for its
85
96
  # crops.
86
97
  class WebPage; end
87
-
88
- # Label to provide extra metadata for the web detection.
89
- # @!attribute [rw] label
90
- # @return [String]
91
- # Label for extra metadata.
92
- # @!attribute [rw] language_code
93
- # @return [String]
94
- # The BCP-47 language code for `label`, such as "en-US" or "sr-Latn".
95
- # For more information, see
96
- # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
97
- class WebLabel; end
98
98
  end
99
99
  end
100
100
  end
@@ -184,6 +184,16 @@ module Google
184
184
  defaults["batch_annotate_images"],
185
185
  exception_transformer: exception_transformer
186
186
  )
187
+ @batch_annotate_files = Google::Gax.create_api_call(
188
+ @image_annotator_stub.method(:batch_annotate_files),
189
+ defaults["batch_annotate_files"],
190
+ exception_transformer: exception_transformer
191
+ )
192
+ @async_batch_annotate_images = Google::Gax.create_api_call(
193
+ @image_annotator_stub.method(:async_batch_annotate_images),
194
+ defaults["async_batch_annotate_images"],
195
+ exception_transformer: exception_transformer
196
+ )
187
197
  @async_batch_annotate_files = Google::Gax.create_api_call(
188
198
  @image_annotator_stub.method(:async_batch_annotate_files),
189
199
  defaults["async_batch_annotate_files"],
@@ -227,6 +237,128 @@ module Google
227
237
  @batch_annotate_images.call(req, options, &block)
228
238
  end
229
239
 
240
+ # Service that performs image detection and annotation for a batch of files.
241
+ # Now only "application/pdf", "image/tiff" and "image/gif" are supported.
242
+ #
243
+ # This service will extract at most 5 (customers can specify which 5 in
244
+ # AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
245
+ # file provided and perform detection and annotation for each image
246
+ # extracted.
247
+ #
248
+ # @param requests [Array<Google::Cloud::Vision::V1::AnnotateFileRequest | Hash>]
249
+ # The list of file annotation requests. Right now we support only one
250
+ # AnnotateFileRequest in BatchAnnotateFilesRequest.
251
+ # A hash of the same form as `Google::Cloud::Vision::V1::AnnotateFileRequest`
252
+ # can also be provided.
253
+ # @param options [Google::Gax::CallOptions]
254
+ # Overrides the default settings for this call, e.g, timeout,
255
+ # retries, etc.
256
+ # @yield [result, operation] Access the result along with the RPC operation
257
+ # @yieldparam result [Google::Cloud::Vision::V1::BatchAnnotateFilesResponse]
258
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
259
+ # @return [Google::Cloud::Vision::V1::BatchAnnotateFilesResponse]
260
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
261
+ # @example
262
+ # require "google/cloud/vision"
263
+ #
264
+ # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
265
+ #
266
+ # # TODO: Initialize `requests`:
267
+ # requests = []
268
+ # response = image_annotator_client.batch_annotate_files(requests)
269
+
270
+ def batch_annotate_files \
271
+ requests,
272
+ options: nil,
273
+ &block
274
+ req = {
275
+ requests: requests
276
+ }.delete_if { |_, v| v.nil? }
277
+ req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::BatchAnnotateFilesRequest)
278
+ @batch_annotate_files.call(req, options, &block)
279
+ end
280
+
281
+ # Run asynchronous image detection and annotation for a list of images.
282
+ #
283
+ # Progress and results can be retrieved through the
284
+ # `google.longrunning.Operations` interface.
285
+ # `Operation.metadata` contains `OperationMetadata` (metadata).
286
+ # `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
287
+ #
288
+ # This service will write image annotation outputs to json files in customer
289
+ # GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
290
+ #
291
+ # @param requests [Array<Google::Cloud::Vision::V1::AnnotateImageRequest | Hash>]
292
+ # Individual image annotation requests for this batch.
293
+ # A hash of the same form as `Google::Cloud::Vision::V1::AnnotateImageRequest`
294
+ # can also be provided.
295
+ # @param output_config [Google::Cloud::Vision::V1::OutputConfig | Hash]
296
+ # Required. The desired output location and metadata (e.g. format).
297
+ # A hash of the same form as `Google::Cloud::Vision::V1::OutputConfig`
298
+ # can also be provided.
299
+ # @param options [Google::Gax::CallOptions]
300
+ # Overrides the default settings for this call, e.g, timeout,
301
+ # retries, etc.
302
+ # @return [Google::Gax::Operation]
303
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
304
+ # @example
305
+ # require "google/cloud/vision"
306
+ #
307
+ # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
308
+ #
309
+ # # TODO: Initialize `requests`:
310
+ # requests = []
311
+ #
312
+ # # TODO: Initialize `output_config`:
313
+ # output_config = {}
314
+ #
315
+ # # Register a callback during the method call.
316
+ # operation = image_annotator_client.async_batch_annotate_images(requests, output_config) do |op|
317
+ # raise op.results.message if op.error?
318
+ # op_results = op.results
319
+ # # Process the results.
320
+ #
321
+ # metadata = op.metadata
322
+ # # Process the metadata.
323
+ # end
324
+ #
325
+ # # Or use the return value to register a callback.
326
+ # operation.on_done do |op|
327
+ # raise op.results.message if op.error?
328
+ # op_results = op.results
329
+ # # Process the results.
330
+ #
331
+ # metadata = op.metadata
332
+ # # Process the metadata.
333
+ # end
334
+ #
335
+ # # Manually reload the operation.
336
+ # operation.reload!
337
+ #
338
+ # # Or block until the operation completes, triggering callbacks on
339
+ # # completion.
340
+ # operation.wait_until_done!
341
+
342
+ def async_batch_annotate_images \
343
+ requests,
344
+ output_config,
345
+ options: nil
346
+ req = {
347
+ requests: requests,
348
+ output_config: output_config
349
+ }.delete_if { |_, v| v.nil? }
350
+ req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest)
351
+ operation = Google::Gax::Operation.new(
352
+ @async_batch_annotate_images.call(req, options),
353
+ @operations_client,
354
+ Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesResponse,
355
+ Google::Cloud::Vision::V1::OperationMetadata,
356
+ call_options: options
357
+ )
358
+ operation.on_done { |operation| yield(operation) } if block_given?
359
+ operation
360
+ end
361
+
230
362
  # Run asynchronous image detection and annotation for a list of generic
231
363
  # files, such as PDF files, which may contain multiple pages and multiple
232
364
  # images per page. Progress and results can be retrieved through the