google-cloud-automl-v1 0.1.0 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +1 -1
- data/lib/google/cloud/automl/v1.rb +1 -1
- data/lib/google/cloud/automl/v1/automl.rb +1 -1
- data/lib/google/cloud/automl/v1/automl/client.rb +382 -377
- data/lib/google/cloud/automl/v1/automl/credentials.rb +1 -1
- data/lib/google/cloud/automl/v1/automl/operations.rb +109 -103
- data/lib/google/cloud/automl/v1/automl/paths.rb +16 -16
- data/lib/google/cloud/automl/v1/prediction_service.rb +1 -1
- data/lib/google/cloud/automl/v1/prediction_service/client.rb +125 -124
- data/lib/google/cloud/automl/v1/prediction_service/credentials.rb +1 -1
- data/lib/google/cloud/automl/v1/prediction_service/operations.rb +109 -103
- data/lib/google/cloud/automl/v1/prediction_service/paths.rb +3 -3
- data/lib/google/cloud/automl/v1/prediction_service_services_pb.rb +30 -34
- data/lib/google/cloud/automl/v1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/automl/v1/annotation_payload.rb +10 -10
- data/proto_docs/google/cloud/automl/v1/annotation_spec.rb +5 -5
- data/proto_docs/google/cloud/automl/v1/classification.rb +37 -37
- data/proto_docs/google/cloud/automl/v1/data_items.rb +38 -38
- data/proto_docs/google/cloud/automl/v1/dataset.rb +19 -19
- data/proto_docs/google/cloud/automl/v1/detection.rb +20 -20
- data/proto_docs/google/cloud/automl/v1/geometry.rb +7 -7
- data/proto_docs/google/cloud/automl/v1/image.rb +38 -38
- data/proto_docs/google/cloud/automl/v1/io.rb +55 -62
- data/proto_docs/google/cloud/automl/v1/model.rb +20 -20
- data/proto_docs/google/cloud/automl/v1/model_evaluation.rb +15 -15
- data/proto_docs/google/cloud/automl/v1/operations.rb +49 -49
- data/proto_docs/google/cloud/automl/v1/prediction_service.rb +53 -53
- data/proto_docs/google/cloud/automl/v1/service.rb +115 -115
- data/proto_docs/google/cloud/automl/v1/text.rb +15 -15
- data/proto_docs/google/cloud/automl/v1/text_extraction.rb +14 -14
- data/proto_docs/google/cloud/automl/v1/text_segment.rb +5 -5
- data/proto_docs/google/cloud/automl/v1/text_sentiment.rb +14 -14
- data/proto_docs/google/cloud/automl/v1/translation.rb +16 -16
- data/proto_docs/google/longrunning/operations.rb +30 -30
- data/proto_docs/google/protobuf/any.rb +4 -4
- data/proto_docs/google/protobuf/duration.rb +4 -4
- data/proto_docs/google/protobuf/empty.rb +2 -2
- data/proto_docs/google/protobuf/field_mask.rb +3 -3
- data/proto_docs/google/protobuf/struct.rb +18 -18
- data/proto_docs/google/protobuf/timestamp.rb +4 -4
- data/proto_docs/google/rpc/status.rb +6 -6
- metadata +33 -6
- data/lib/google/cloud/common_resources_pb.rb +0 -15
@@ -36,11 +36,11 @@ module Google
|
|
36
36
|
# @param dataset [String]
|
37
37
|
# @param annotation_spec [String]
|
38
38
|
#
|
39
|
-
# @return [String]
|
39
|
+
# @return [::String]
|
40
40
|
def annotation_spec_path project:, location:, dataset:, annotation_spec:
|
41
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
42
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
43
|
-
raise ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
42
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
43
|
+
raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
|
44
44
|
|
45
45
|
"projects/#{project}/locations/#{location}/datasets/#{dataset}/annotationSpecs/#{annotation_spec}"
|
46
46
|
end
|
@@ -56,10 +56,10 @@ module Google
|
|
56
56
|
# @param location [String]
|
57
57
|
# @param dataset [String]
|
58
58
|
#
|
59
|
-
# @return [String]
|
59
|
+
# @return [::String]
|
60
60
|
def dataset_path project:, location:, dataset:
|
61
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
62
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
61
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
62
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
63
63
|
|
64
64
|
"projects/#{project}/locations/#{location}/datasets/#{dataset}"
|
65
65
|
end
|
@@ -74,9 +74,9 @@ module Google
|
|
74
74
|
# @param project [String]
|
75
75
|
# @param location [String]
|
76
76
|
#
|
77
|
-
# @return [String]
|
77
|
+
# @return [::String]
|
78
78
|
def location_path project:, location:
|
79
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
79
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
80
80
|
|
81
81
|
"projects/#{project}/locations/#{location}"
|
82
82
|
end
|
@@ -92,10 +92,10 @@ module Google
|
|
92
92
|
# @param location [String]
|
93
93
|
# @param model [String]
|
94
94
|
#
|
95
|
-
# @return [String]
|
95
|
+
# @return [::String]
|
96
96
|
def model_path project:, location:, model:
|
97
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
98
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
97
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
98
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
99
99
|
|
100
100
|
"projects/#{project}/locations/#{location}/models/#{model}"
|
101
101
|
end
|
@@ -112,11 +112,11 @@ module Google
|
|
112
112
|
# @param model [String]
|
113
113
|
# @param model_evaluation [String]
|
114
114
|
#
|
115
|
-
# @return [String]
|
115
|
+
# @return [::String]
|
116
116
|
def model_evaluation_path project:, location:, model:, model_evaluation:
|
117
|
-
raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
118
|
-
raise ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
119
|
-
raise ArgumentError, "model cannot contain /" if model.to_s.include? "/"
|
117
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
118
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
119
|
+
raise ::ArgumentError, "model cannot contain /" if model.to_s.include? "/"
|
120
120
|
|
121
121
|
"projects/#{project}/locations/#{location}/models/#{model}/modelEvaluations/#{model_evaluation}"
|
122
122
|
end
|
@@ -40,7 +40,7 @@ module Google
|
|
40
40
|
# To load this service and instantiate a client:
|
41
41
|
#
|
42
42
|
# require "google/cloud/automl/v1/prediction_service"
|
43
|
-
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new
|
43
|
+
# client = ::Google::Cloud::AutoML::V1::PredictionService::Client.new
|
44
44
|
#
|
45
45
|
module PredictionService
|
46
46
|
end
|
@@ -41,15 +41,15 @@ module Google
|
|
41
41
|
##
|
42
42
|
# Configure the PredictionService Client class.
|
43
43
|
#
|
44
|
-
# See {Google::Cloud::AutoML::V1::PredictionService::Client::Configuration}
|
44
|
+
# See {::Google::Cloud::AutoML::V1::PredictionService::Client::Configuration}
|
45
45
|
# for a description of the configuration fields.
|
46
46
|
#
|
47
47
|
# ## Example
|
48
48
|
#
|
49
49
|
# To modify the configuration for all PredictionService clients:
|
50
50
|
#
|
51
|
-
# Google::Cloud::AutoML::V1::PredictionService::Client.configure do |config|
|
52
|
-
# config.timeout =
|
51
|
+
# ::Google::Cloud::AutoML::V1::PredictionService::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
53
|
# end
|
54
54
|
#
|
55
55
|
# @yield [config] Configure the Client client.
|
@@ -85,7 +85,7 @@ module Google
|
|
85
85
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
86
|
# should be made on {Client.configure}.
|
87
87
|
#
|
88
|
-
# See {Google::Cloud::AutoML::V1::PredictionService::Client::Configuration}
|
88
|
+
# See {::Google::Cloud::AutoML::V1::PredictionService::Client::Configuration}
|
89
89
|
# for a description of the configuration fields.
|
90
90
|
#
|
91
91
|
# @yield [config] Configure the Client client.
|
@@ -106,13 +106,13 @@ module Google
|
|
106
106
|
# To create a new PredictionService client with the default
|
107
107
|
# configuration:
|
108
108
|
#
|
109
|
-
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new
|
109
|
+
# client = ::Google::Cloud::AutoML::V1::PredictionService::Client.new
|
110
110
|
#
|
111
111
|
# To create a new PredictionService client with a custom
|
112
112
|
# configuration:
|
113
113
|
#
|
114
|
-
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new do |config|
|
115
|
-
# config.timeout =
|
114
|
+
# client = ::Google::Cloud::AutoML::V1::PredictionService::Client.new do |config|
|
115
|
+
# config.timeout = 10.0
|
116
116
|
# end
|
117
117
|
#
|
118
118
|
# @yield [config] Configure the PredictionService client.
|
@@ -137,15 +137,16 @@ module Google
|
|
137
137
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
138
138
|
credentials = Credentials.new credentials, scope: @config.scope
|
139
139
|
end
|
140
|
-
@quota_project_id =
|
140
|
+
@quota_project_id = @config.quota_project
|
141
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
141
142
|
|
142
143
|
@operations_client = Operations.new do |config|
|
143
144
|
config.credentials = credentials
|
144
145
|
config.endpoint = @config.endpoint
|
145
146
|
end
|
146
147
|
|
147
|
-
@prediction_service_stub = Gapic::ServiceStub.new(
|
148
|
-
Google::Cloud::AutoML::V1::PredictionService::Stub,
|
148
|
+
@prediction_service_stub = ::Gapic::ServiceStub.new(
|
149
|
+
::Google::Cloud::AutoML::V1::PredictionService::Stub,
|
149
150
|
credentials: credentials,
|
150
151
|
endpoint: @config.endpoint,
|
151
152
|
channel_args: @config.channel_args,
|
@@ -156,7 +157,7 @@ module Google
|
|
156
157
|
##
|
157
158
|
# Get the associated client for long-running operations.
|
158
159
|
#
|
159
|
-
# @return [Google::Cloud::AutoML::V1::PredictionService::Operations]
|
160
|
+
# @return [::Google::Cloud::AutoML::V1::PredictionService::Operations]
|
160
161
|
#
|
161
162
|
attr_reader :operations_client
|
162
163
|
|
@@ -167,51 +168,47 @@ module Google
|
|
167
168
|
# returned in the response.
|
168
169
|
# Available for following ML scenarios, and their expected request payloads:
|
169
170
|
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
174
|
-
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
190
|
-
#
|
191
|
-
#
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
#
|
198
|
-
#
|
199
|
-
#
|
200
|
-
# <td>A row with column values matching
|
171
|
+
# AutoML Vision Classification
|
172
|
+
#
|
173
|
+
# * An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB.
|
174
|
+
#
|
175
|
+
# AutoML Vision Object Detection
|
176
|
+
#
|
177
|
+
# * An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB.
|
178
|
+
#
|
179
|
+
# AutoML Natural Language Classification
|
180
|
+
#
|
181
|
+
# * A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in
|
182
|
+
# .PDF, .TIF or .TIFF format with size upto 2MB.
|
183
|
+
#
|
184
|
+
# AutoML Natural Language Entity Extraction
|
185
|
+
#
|
186
|
+
# * A TextSnippet up to 10,000 characters, UTF-8 NFC encoded or a document
|
187
|
+
# in .PDF, .TIF or .TIFF format with size upto 20MB.
|
188
|
+
#
|
189
|
+
# AutoML Natural Language Sentiment Analysis
|
190
|
+
#
|
191
|
+
# * A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in
|
192
|
+
# .PDF, .TIF or .TIFF format with size upto 2MB.
|
193
|
+
#
|
194
|
+
# AutoML Translation
|
195
|
+
#
|
196
|
+
# * A TextSnippet up to 25,000 characters, UTF-8 encoded.
|
197
|
+
#
|
198
|
+
# AutoML Tables
|
199
|
+
#
|
200
|
+
# * A row with column values matching
|
201
201
|
# the columns of the model, up to 5MB. Not available for FORECASTING
|
202
202
|
# `prediction_type`.
|
203
|
-
# </td>
|
204
|
-
# </tr>
|
205
|
-
# </table>
|
206
203
|
#
|
207
204
|
# @overload predict(request, options = nil)
|
208
205
|
# Pass arguments to `predict` via a request object, either of type
|
209
|
-
# {Google::Cloud::AutoML::V1::PredictRequest} or an equivalent Hash.
|
206
|
+
# {::Google::Cloud::AutoML::V1::PredictRequest} or an equivalent Hash.
|
210
207
|
#
|
211
|
-
# @param request [Google::Cloud::AutoML::V1::PredictRequest, Hash]
|
208
|
+
# @param request [::Google::Cloud::AutoML::V1::PredictRequest, ::Hash]
|
212
209
|
# A request object representing the call parameters. Required. To specify no
|
213
210
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
214
|
-
# @param options [Gapic::CallOptions, Hash]
|
211
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
215
212
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
216
213
|
#
|
217
214
|
# @overload predict(name: nil, payload: nil, params: nil)
|
@@ -219,23 +216,23 @@ module Google
|
|
219
216
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
220
217
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
221
218
|
#
|
222
|
-
# @param name [String]
|
219
|
+
# @param name [::String]
|
223
220
|
# Required. Name of the model requested to serve the prediction.
|
224
|
-
# @param payload [Google::Cloud::AutoML::V1::ExamplePayload, Hash]
|
221
|
+
# @param payload [::Google::Cloud::AutoML::V1::ExamplePayload, ::Hash]
|
225
222
|
# Required. Payload to perform a prediction on. The payload must match the
|
226
223
|
# problem type that the model was trained to solve.
|
227
|
-
# @param params [Hash{String => String}]
|
224
|
+
# @param params [::Hash{::String => ::String}]
|
228
225
|
# Additional domain-specific parameters, any string must be up to 25000
|
229
226
|
# characters long.
|
230
227
|
#
|
231
|
-
#
|
228
|
+
# AutoML Vision Classification
|
232
229
|
#
|
233
230
|
# `score_threshold`
|
234
231
|
# : (float) A value from 0.0 to 1.0. When the model
|
235
232
|
# makes predictions for an image, it will only produce results that have
|
236
233
|
# at least this confidence score. The default is 0.5.
|
237
234
|
#
|
238
|
-
#
|
235
|
+
# AutoML Vision Object Detection
|
239
236
|
#
|
240
237
|
# `score_threshold`
|
241
238
|
# : (float) When Model detects objects on the image,
|
@@ -247,7 +244,7 @@ module Google
|
|
247
244
|
# boxes returned. The default is 100. The
|
248
245
|
# number of returned bounding boxes might be limited by the server.
|
249
246
|
#
|
250
|
-
#
|
247
|
+
# AutoML Tables
|
251
248
|
#
|
252
249
|
# `feature_importance`
|
253
250
|
# : (boolean) Whether
|
@@ -258,26 +255,26 @@ module Google
|
|
258
255
|
# objects. The default is false.
|
259
256
|
#
|
260
257
|
# @yield [response, operation] Access the result along with the RPC operation
|
261
|
-
# @yieldparam response [Google::Cloud::AutoML::V1::PredictResponse]
|
262
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
258
|
+
# @yieldparam response [::Google::Cloud::AutoML::V1::PredictResponse]
|
259
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
263
260
|
#
|
264
|
-
# @return [Google::Cloud::AutoML::V1::PredictResponse]
|
261
|
+
# @return [::Google::Cloud::AutoML::V1::PredictResponse]
|
265
262
|
#
|
266
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
263
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
267
264
|
#
|
268
265
|
def predict request, options = nil
|
269
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
266
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
270
267
|
|
271
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::AutoML::V1::PredictRequest
|
268
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AutoML::V1::PredictRequest
|
272
269
|
|
273
270
|
# Converts hash and nil to an options object
|
274
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
271
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
275
272
|
|
276
273
|
# Customize the options with defaults
|
277
274
|
metadata = @config.rpcs.predict.metadata.to_h
|
278
275
|
|
279
276
|
# Set x-goog-api-client and x-goog-user-project headers
|
280
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
277
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
281
278
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
282
279
|
gapic_version: ::Google::Cloud::Automl::V1::VERSION
|
283
280
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -298,17 +295,17 @@ module Google
|
|
298
295
|
yield response, operation if block_given?
|
299
296
|
return response
|
300
297
|
end
|
301
|
-
rescue GRPC::BadStatus => e
|
302
|
-
raise Google::Cloud::Error.from_error(e)
|
298
|
+
rescue ::GRPC::BadStatus => e
|
299
|
+
raise ::Google::Cloud::Error.from_error(e)
|
303
300
|
end
|
304
301
|
|
305
302
|
##
|
306
|
-
# Perform a batch prediction. Unlike the online {Google::Cloud::AutoML::V1::PredictionService::Client#predict Predict}, batch
|
303
|
+
# Perform a batch prediction. Unlike the online {::Google::Cloud::AutoML::V1::PredictionService::Client#predict Predict}, batch
|
307
304
|
# prediction result won't be immediately available in the response. Instead,
|
308
305
|
# a long running operation object is returned. User can poll the operation
|
309
306
|
# result via GetOperation
|
310
|
-
# method. Once the operation is done, {Google::Cloud::AutoML::V1::BatchPredictResult BatchPredictResult} is returned in
|
311
|
-
# the {Google::Longrunning::Operation#response response} field.
|
307
|
+
# method. Once the operation is done, {::Google::Cloud::AutoML::V1::BatchPredictResult BatchPredictResult} is returned in
|
308
|
+
# the {::Google::Longrunning::Operation#response response} field.
|
312
309
|
# Available for following ML scenarios:
|
313
310
|
#
|
314
311
|
# * AutoML Vision Classification
|
@@ -321,12 +318,12 @@ module Google
|
|
321
318
|
#
|
322
319
|
# @overload batch_predict(request, options = nil)
|
323
320
|
# Pass arguments to `batch_predict` via a request object, either of type
|
324
|
-
# {Google::Cloud::AutoML::V1::BatchPredictRequest} or an equivalent Hash.
|
321
|
+
# {::Google::Cloud::AutoML::V1::BatchPredictRequest} or an equivalent Hash.
|
325
322
|
#
|
326
|
-
# @param request [Google::Cloud::AutoML::V1::BatchPredictRequest, Hash]
|
323
|
+
# @param request [::Google::Cloud::AutoML::V1::BatchPredictRequest, ::Hash]
|
327
324
|
# A request object representing the call parameters. Required. To specify no
|
328
325
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
329
|
-
# @param options [Gapic::CallOptions, Hash]
|
326
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
330
327
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
331
328
|
#
|
332
329
|
# @overload batch_predict(name: nil, input_config: nil, output_config: nil, params: nil)
|
@@ -334,18 +331,18 @@ module Google
|
|
334
331
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
335
332
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
336
333
|
#
|
337
|
-
# @param name [String]
|
334
|
+
# @param name [::String]
|
338
335
|
# Required. Name of the model requested to serve the batch prediction.
|
339
|
-
# @param input_config [Google::Cloud::AutoML::V1::BatchPredictInputConfig, Hash]
|
336
|
+
# @param input_config [::Google::Cloud::AutoML::V1::BatchPredictInputConfig, ::Hash]
|
340
337
|
# Required. The input configuration for batch prediction.
|
341
|
-
# @param output_config [Google::Cloud::AutoML::V1::BatchPredictOutputConfig, Hash]
|
338
|
+
# @param output_config [::Google::Cloud::AutoML::V1::BatchPredictOutputConfig, ::Hash]
|
342
339
|
# Required. The Configuration specifying where output predictions should
|
343
340
|
# be written.
|
344
|
-
# @param params [Hash{String => String}]
|
341
|
+
# @param params [::Hash{::String => ::String}]
|
345
342
|
# Additional domain-specific parameters for the predictions, any string must
|
346
343
|
# be up to 25000 characters long.
|
347
344
|
#
|
348
|
-
#
|
345
|
+
# AutoML Natural Language Classification
|
349
346
|
#
|
350
347
|
# `score_threshold`
|
351
348
|
# : (float) A value from 0.0 to 1.0. When the model
|
@@ -353,14 +350,14 @@ module Google
|
|
353
350
|
# that have at least this confidence score. The default is 0.5.
|
354
351
|
#
|
355
352
|
#
|
356
|
-
#
|
353
|
+
# AutoML Vision Classification
|
357
354
|
#
|
358
355
|
# `score_threshold`
|
359
356
|
# : (float) A value from 0.0 to 1.0. When the model
|
360
357
|
# makes predictions for an image, it will only produce results that
|
361
358
|
# have at least this confidence score. The default is 0.5.
|
362
359
|
#
|
363
|
-
#
|
360
|
+
# AutoML Vision Object Detection
|
364
361
|
#
|
365
362
|
# `score_threshold`
|
366
363
|
# : (float) When Model detects objects on the image,
|
@@ -371,7 +368,7 @@ module Google
|
|
371
368
|
# : (int64) The maximum number of bounding
|
372
369
|
# boxes returned per image. The default is 100, the
|
373
370
|
# number of bounding boxes returned might be limited by the server.
|
374
|
-
#
|
371
|
+
# AutoML Video Intelligence Classification
|
375
372
|
#
|
376
373
|
# `score_threshold`
|
377
374
|
# : (float) A value from 0.0 to 1.0. When the model
|
@@ -409,7 +406,7 @@ module Google
|
|
409
406
|
# type, the quality of it depends on training data, but there are no
|
410
407
|
# metrics provided to describe that quality.
|
411
408
|
#
|
412
|
-
#
|
409
|
+
# AutoML Video Intelligence Object Tracking
|
413
410
|
#
|
414
411
|
# `score_threshold`
|
415
412
|
# : (float) When Model detects objects on video frames,
|
@@ -427,26 +424,26 @@ module Google
|
|
427
424
|
# returned. Value in 0 to 1 range. Default is 0.
|
428
425
|
#
|
429
426
|
# @yield [response, operation] Access the result along with the RPC operation
|
430
|
-
# @yieldparam response [Gapic::Operation]
|
431
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
427
|
+
# @yieldparam response [::Gapic::Operation]
|
428
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
432
429
|
#
|
433
|
-
# @return [Gapic::Operation]
|
430
|
+
# @return [::Gapic::Operation]
|
434
431
|
#
|
435
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
432
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
436
433
|
#
|
437
434
|
def batch_predict request, options = nil
|
438
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
435
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
439
436
|
|
440
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::AutoML::V1::BatchPredictRequest
|
437
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AutoML::V1::BatchPredictRequest
|
441
438
|
|
442
439
|
# Converts hash and nil to an options object
|
443
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
440
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
444
441
|
|
445
442
|
# Customize the options with defaults
|
446
443
|
metadata = @config.rpcs.batch_predict.metadata.to_h
|
447
444
|
|
448
445
|
# Set x-goog-api-client and x-goog-user-project headers
|
449
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
446
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
450
447
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
451
448
|
gapic_version: ::Google::Cloud::Automl::V1::VERSION
|
452
449
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -464,12 +461,12 @@ module Google
|
|
464
461
|
retry_policy: @config.retry_policy
|
465
462
|
|
466
463
|
@prediction_service_stub.call_rpc :batch_predict, request, options: options do |response, operation|
|
467
|
-
response = Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
468
465
|
yield response, operation if block_given?
|
469
466
|
return response
|
470
467
|
end
|
471
|
-
rescue GRPC::BadStatus => e
|
472
|
-
raise Google::Cloud::Error.from_error(e)
|
468
|
+
rescue ::GRPC::BadStatus => e
|
469
|
+
raise ::Google::Cloud::Error.from_error(e)
|
473
470
|
end
|
474
471
|
|
475
472
|
##
|
@@ -479,7 +476,7 @@ module Google
|
|
479
476
|
# providing control over timeouts, retry behavior, logging, transport
|
480
477
|
# parameters, and other low-level controls. Certain parameters can also be
|
481
478
|
# applied individually to specific RPCs. See
|
482
|
-
# {Google::Cloud::AutoML::V1::PredictionService::Client::Configuration::Rpcs}
|
479
|
+
# {::Google::Cloud::AutoML::V1::PredictionService::Client::Configuration::Rpcs}
|
483
480
|
# for a list of RPCs that can be configured independently.
|
484
481
|
#
|
485
482
|
# Configuration can be applied globally to all clients, or to a single client
|
@@ -490,22 +487,22 @@ module Google
|
|
490
487
|
# To modify the global config, setting the timeout for predict
|
491
488
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
492
489
|
#
|
493
|
-
# Google::Cloud::AutoML::V1::PredictionService::Client.configure do |config|
|
494
|
-
# config.timeout =
|
495
|
-
# config.rpcs.predict.timeout =
|
490
|
+
# ::Google::Cloud::AutoML::V1::PredictionService::Client.configure do |config|
|
491
|
+
# config.timeout = 10.0
|
492
|
+
# config.rpcs.predict.timeout = 20.0
|
496
493
|
# end
|
497
494
|
#
|
498
495
|
# To apply the above configuration only to a new client:
|
499
496
|
#
|
500
|
-
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new do |config|
|
501
|
-
# config.timeout =
|
502
|
-
# config.rpcs.predict.timeout =
|
497
|
+
# client = ::Google::Cloud::AutoML::V1::PredictionService::Client.new do |config|
|
498
|
+
# config.timeout = 10.0
|
499
|
+
# config.rpcs.predict.timeout = 20.0
|
503
500
|
# end
|
504
501
|
#
|
505
502
|
# @!attribute [rw] endpoint
|
506
503
|
# The hostname or hostname:port of the service endpoint.
|
507
504
|
# Defaults to `"automl.googleapis.com"`.
|
508
|
-
# @return [String]
|
505
|
+
# @return [::String]
|
509
506
|
# @!attribute [rw] credentials
|
510
507
|
# Credentials to send with calls. You may provide any of the following types:
|
511
508
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -517,29 +514,29 @@ module Google
|
|
517
514
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
518
515
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
519
516
|
# * (`nil`) indicating no credentials
|
520
|
-
# @return [Object]
|
517
|
+
# @return [::Object]
|
521
518
|
# @!attribute [rw] scope
|
522
519
|
# The OAuth scopes
|
523
|
-
# @return [Array
|
520
|
+
# @return [::Array<::String>]
|
524
521
|
# @!attribute [rw] lib_name
|
525
522
|
# The library name as recorded in instrumentation and logging
|
526
|
-
# @return [String]
|
523
|
+
# @return [::String]
|
527
524
|
# @!attribute [rw] lib_version
|
528
525
|
# The library version as recorded in instrumentation and logging
|
529
|
-
# @return [String]
|
526
|
+
# @return [::String]
|
530
527
|
# @!attribute [rw] channel_args
|
531
528
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
532
529
|
# `GRPC::Core::Channel` object is provided as the credential.
|
533
|
-
# @return [Hash]
|
530
|
+
# @return [::Hash]
|
534
531
|
# @!attribute [rw] interceptors
|
535
532
|
# An array of interceptors that are run before calls are executed.
|
536
|
-
# @return [Array
|
533
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
537
534
|
# @!attribute [rw] timeout
|
538
|
-
# The call timeout in
|
539
|
-
# @return [Numeric]
|
535
|
+
# The call timeout in seconds.
|
536
|
+
# @return [::Numeric]
|
540
537
|
# @!attribute [rw] metadata
|
541
538
|
# Additional gRPC headers to be sent with the call.
|
542
|
-
# @return [Hash{Symbol
|
539
|
+
# @return [::Hash{::Symbol=>::String}]
|
543
540
|
# @!attribute [rw] retry_policy
|
544
541
|
# The retry policy. The value is a hash with the following keys:
|
545
542
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
@@ -547,25 +544,29 @@ module Google
|
|
547
544
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
548
545
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
549
546
|
# trigger a retry.
|
550
|
-
# @return [Hash]
|
547
|
+
# @return [::Hash]
|
548
|
+
# @!attribute [rw] quota_project
|
549
|
+
# A separate project against which to charge quota.
|
550
|
+
# @return [::String]
|
551
551
|
#
|
552
552
|
class Configuration
|
553
|
-
extend Gapic::Config
|
553
|
+
extend ::Gapic::Config
|
554
554
|
|
555
|
-
config_attr :endpoint,
|
556
|
-
config_attr :credentials,
|
555
|
+
config_attr :endpoint, "automl.googleapis.com", ::String
|
556
|
+
config_attr :credentials, nil do |value|
|
557
557
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
558
558
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
559
559
|
allowed.any? { |klass| klass === value }
|
560
560
|
end
|
561
|
-
config_attr :scope,
|
562
|
-
config_attr :lib_name,
|
563
|
-
config_attr :lib_version,
|
564
|
-
config_attr(:channel_args,
|
565
|
-
config_attr :interceptors,
|
566
|
-
config_attr :timeout,
|
567
|
-
config_attr :metadata,
|
568
|
-
config_attr :retry_policy,
|
561
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
562
|
+
config_attr :lib_name, nil, ::String, nil
|
563
|
+
config_attr :lib_version, nil, ::String, nil
|
564
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
565
|
+
config_attr :interceptors, nil, ::Array, nil
|
566
|
+
config_attr :timeout, nil, ::Numeric, nil
|
567
|
+
config_attr :metadata, nil, ::Hash, nil
|
568
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
569
|
+
config_attr :quota_project, nil, ::String, nil
|
569
570
|
|
570
571
|
# @private
|
571
572
|
def initialize parent_config = nil
|
@@ -581,7 +582,7 @@ module Google
|
|
581
582
|
def rpcs
|
582
583
|
@rpcs ||= begin
|
583
584
|
parent_rpcs = nil
|
584
|
-
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to?
|
585
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
585
586
|
Rpcs.new parent_rpcs
|
586
587
|
end
|
587
588
|
end
|
@@ -606,21 +607,21 @@ module Google
|
|
606
607
|
class Rpcs
|
607
608
|
##
|
608
609
|
# RPC-specific configuration for `predict`
|
609
|
-
# @return [Gapic::Config::Method]
|
610
|
+
# @return [::Gapic::Config::Method]
|
610
611
|
#
|
611
612
|
attr_reader :predict
|
612
613
|
##
|
613
614
|
# RPC-specific configuration for `batch_predict`
|
614
|
-
# @return [Gapic::Config::Method]
|
615
|
+
# @return [::Gapic::Config::Method]
|
615
616
|
#
|
616
617
|
attr_reader :batch_predict
|
617
618
|
|
618
619
|
# @private
|
619
620
|
def initialize parent_rpcs = nil
|
620
621
|
predict_config = parent_rpcs&.predict if parent_rpcs&.respond_to? :predict
|
621
|
-
@predict = Gapic::Config::Method.new predict_config
|
622
|
+
@predict = ::Gapic::Config::Method.new predict_config
|
622
623
|
batch_predict_config = parent_rpcs&.batch_predict if parent_rpcs&.respond_to? :batch_predict
|
623
|
-
@batch_predict = Gapic::Config::Method.new batch_predict_config
|
624
|
+
@batch_predict = ::Gapic::Config::Method.new batch_predict_config
|
624
625
|
|
625
626
|
yield self if block_given?
|
626
627
|
end
|