google-cloud-automl-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google/cloud/automl/v1/annotation_payload_pb.rb +37 -0
- data/lib/google/cloud/automl/v1/annotation_spec_pb.rb +26 -0
- data/lib/google/cloud/automl/v1/automl/client.rb +1851 -0
- data/lib/google/cloud/automl/v1/automl/credentials.rb +51 -0
- data/lib/google/cloud/automl/v1/automl/operations.rb +564 -0
- data/lib/google/cloud/automl/v1/automl/paths.rb +130 -0
- data/lib/google/cloud/automl/v1/automl.rb +63 -0
- data/lib/google/cloud/automl/v1/classification_pb.rb +65 -0
- data/lib/google/cloud/automl/v1/data_items_pb.rb +87 -0
- data/lib/google/cloud/automl/v1/dataset_pb.rb +42 -0
- data/lib/google/cloud/automl/v1/detection_pb.rb +45 -0
- data/lib/google/cloud/automl/v1/geometry_pb.rb +28 -0
- data/lib/google/cloud/automl/v1/image_pb.rb +57 -0
- data/lib/google/cloud/automl/v1/io_pb.rb +65 -0
- data/lib/google/cloud/automl/v1/model_evaluation_pb.rb +41 -0
- data/lib/google/cloud/automl/v1/model_pb.rb +49 -0
- data/lib/google/cloud/automl/v1/operations_pb.rb +88 -0
- data/lib/google/cloud/automl/v1/prediction_service/client.rb +634 -0
- data/lib/google/cloud/automl/v1/prediction_service/credentials.rb +51 -0
- data/lib/google/cloud/automl/v1/prediction_service/operations.rb +564 -0
- data/lib/google/cloud/automl/v1/prediction_service/paths.rb +52 -0
- data/lib/google/cloud/automl/v1/prediction_service.rb +53 -0
- data/lib/google/cloud/automl/v1/prediction_service_pb.rb +50 -0
- data/lib/google/cloud/automl/v1/prediction_service_services_pb.rb +103 -0
- data/lib/google/cloud/automl/v1/service_pb.rb +139 -0
- data/lib/google/cloud/automl/v1/service_services_pb.rb +137 -0
- data/lib/google/cloud/automl/v1/text_extraction_pb.rb +39 -0
- data/lib/google/cloud/automl/v1/text_pb.rb +41 -0
- data/lib/google/cloud/automl/v1/text_segment_pb.rb +25 -0
- data/lib/google/cloud/automl/v1/text_sentiment_pb.rb +35 -0
- data/lib/google/cloud/automl/v1/translation_pb.rb +41 -0
- data/lib/google/cloud/automl/v1/version.rb +28 -0
- data/lib/google/cloud/automl/v1.rb +36 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google-cloud-automl-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/automl/v1/annotation_payload.rb +60 -0
- data/proto_docs/google/cloud/automl/v1/annotation_spec.rb +46 -0
- data/proto_docs/google/cloud/automl/v1/classification.rb +191 -0
- data/proto_docs/google/cloud/automl/v1/data_items.rb +197 -0
- data/proto_docs/google/cloud/automl/v1/dataset.rb +94 -0
- data/proto_docs/google/cloud/automl/v1/detection.rb +97 -0
- data/proto_docs/google/cloud/automl/v1/geometry.rb +53 -0
- data/proto_docs/google/cloud/automl/v1/image.rb +217 -0
- data/proto_docs/google/cloud/automl/v1/io.rb +1402 -0
- data/proto_docs/google/cloud/automl/v1/model.rb +109 -0
- data/proto_docs/google/cloud/automl/v1/model_evaluation.rb +94 -0
- data/proto_docs/google/cloud/automl/v1/operations.rb +180 -0
- data/proto_docs/google/cloud/automl/v1/prediction_service.rb +271 -0
- data/proto_docs/google/cloud/automl/v1/service.rb +322 -0
- data/proto_docs/google/cloud/automl/v1/text.rb +76 -0
- data/proto_docs/google/cloud/automl/v1/text_extraction.rb +73 -0
- data/proto_docs/google/cloud/automl/v1/text_segment.rb +44 -0
- data/proto_docs/google/cloud/automl/v1/text_sentiment.rb +82 -0
- data/proto_docs/google/cloud/automl/v1/translation.rb +79 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +227 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/automl/v1/image.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
require 'google/cloud/automl/v1/annotation_spec_pb'
|
8
|
+
require 'google/cloud/automl/v1/classification_pb'
|
9
|
+
require 'google/protobuf/timestamp_pb'
|
10
|
+
require 'google/api/annotations_pb'
|
11
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
12
|
+
add_file("google/cloud/automl/v1/image.proto", :syntax => :proto3) do
|
13
|
+
add_message "google.cloud.automl.v1.ImageClassificationDatasetMetadata" do
|
14
|
+
optional :classification_type, :enum, 1, "google.cloud.automl.v1.ClassificationType"
|
15
|
+
end
|
16
|
+
add_message "google.cloud.automl.v1.ImageObjectDetectionDatasetMetadata" do
|
17
|
+
end
|
18
|
+
add_message "google.cloud.automl.v1.ImageClassificationModelMetadata" do
|
19
|
+
optional :base_model_id, :string, 1
|
20
|
+
optional :train_budget_milli_node_hours, :int64, 16
|
21
|
+
optional :train_cost_milli_node_hours, :int64, 17
|
22
|
+
optional :stop_reason, :string, 5
|
23
|
+
optional :model_type, :string, 7
|
24
|
+
optional :node_qps, :double, 13
|
25
|
+
optional :node_count, :int64, 14
|
26
|
+
end
|
27
|
+
add_message "google.cloud.automl.v1.ImageObjectDetectionModelMetadata" do
|
28
|
+
optional :model_type, :string, 1
|
29
|
+
optional :node_count, :int64, 3
|
30
|
+
optional :node_qps, :double, 4
|
31
|
+
optional :stop_reason, :string, 5
|
32
|
+
optional :train_budget_milli_node_hours, :int64, 6
|
33
|
+
optional :train_cost_milli_node_hours, :int64, 7
|
34
|
+
end
|
35
|
+
add_message "google.cloud.automl.v1.ImageClassificationModelDeploymentMetadata" do
|
36
|
+
optional :node_count, :int64, 1
|
37
|
+
end
|
38
|
+
add_message "google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata" do
|
39
|
+
optional :node_count, :int64, 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module Google
|
45
|
+
module Cloud
|
46
|
+
module AutoML
|
47
|
+
module V1
|
48
|
+
ImageClassificationDatasetMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImageClassificationDatasetMetadata").msgclass
|
49
|
+
ImageObjectDetectionDatasetMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImageObjectDetectionDatasetMetadata").msgclass
|
50
|
+
ImageClassificationModelMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImageClassificationModelMetadata").msgclass
|
51
|
+
ImageObjectDetectionModelMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImageObjectDetectionModelMetadata").msgclass
|
52
|
+
ImageClassificationModelDeploymentMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImageClassificationModelDeploymentMetadata").msgclass
|
53
|
+
ImageObjectDetectionModelDeploymentMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata").msgclass
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/automl/v1/io.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/field_behavior_pb'
|
7
|
+
require 'google/api/annotations_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/cloud/automl/v1/io.proto", :syntax => :proto3) do
|
10
|
+
add_message "google.cloud.automl.v1.InputConfig" do
|
11
|
+
map :params, :string, :string, 2
|
12
|
+
oneof :source do
|
13
|
+
optional :gcs_source, :message, 1, "google.cloud.automl.v1.GcsSource"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
add_message "google.cloud.automl.v1.BatchPredictInputConfig" do
|
17
|
+
oneof :source do
|
18
|
+
optional :gcs_source, :message, 1, "google.cloud.automl.v1.GcsSource"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
add_message "google.cloud.automl.v1.DocumentInputConfig" do
|
22
|
+
optional :gcs_source, :message, 1, "google.cloud.automl.v1.GcsSource"
|
23
|
+
end
|
24
|
+
add_message "google.cloud.automl.v1.OutputConfig" do
|
25
|
+
oneof :destination do
|
26
|
+
optional :gcs_destination, :message, 1, "google.cloud.automl.v1.GcsDestination"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
add_message "google.cloud.automl.v1.BatchPredictOutputConfig" do
|
30
|
+
oneof :destination do
|
31
|
+
optional :gcs_destination, :message, 1, "google.cloud.automl.v1.GcsDestination"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
add_message "google.cloud.automl.v1.ModelExportOutputConfig" do
|
35
|
+
optional :model_format, :string, 4
|
36
|
+
map :params, :string, :string, 2
|
37
|
+
oneof :destination do
|
38
|
+
optional :gcs_destination, :message, 1, "google.cloud.automl.v1.GcsDestination"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
add_message "google.cloud.automl.v1.GcsSource" do
|
42
|
+
repeated :input_uris, :string, 1
|
43
|
+
end
|
44
|
+
add_message "google.cloud.automl.v1.GcsDestination" do
|
45
|
+
optional :output_uri_prefix, :string, 1
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Google
|
51
|
+
module Cloud
|
52
|
+
module AutoML
|
53
|
+
module V1
|
54
|
+
InputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.InputConfig").msgclass
|
55
|
+
BatchPredictInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.BatchPredictInputConfig").msgclass
|
56
|
+
DocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.DocumentInputConfig").msgclass
|
57
|
+
OutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.OutputConfig").msgclass
|
58
|
+
BatchPredictOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.BatchPredictOutputConfig").msgclass
|
59
|
+
ModelExportOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ModelExportOutputConfig").msgclass
|
60
|
+
GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.GcsSource").msgclass
|
61
|
+
GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.GcsDestination").msgclass
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/automl/v1/model_evaluation.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
require 'google/cloud/automl/v1/classification_pb'
|
8
|
+
require 'google/cloud/automl/v1/detection_pb'
|
9
|
+
require 'google/cloud/automl/v1/text_extraction_pb'
|
10
|
+
require 'google/cloud/automl/v1/text_sentiment_pb'
|
11
|
+
require 'google/cloud/automl/v1/translation_pb'
|
12
|
+
require 'google/protobuf/timestamp_pb'
|
13
|
+
require 'google/api/annotations_pb'
|
14
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
15
|
+
add_file("google/cloud/automl/v1/model_evaluation.proto", :syntax => :proto3) do
|
16
|
+
add_message "google.cloud.automl.v1.ModelEvaluation" do
|
17
|
+
optional :name, :string, 1
|
18
|
+
optional :annotation_spec_id, :string, 2
|
19
|
+
optional :display_name, :string, 15
|
20
|
+
optional :create_time, :message, 5, "google.protobuf.Timestamp"
|
21
|
+
optional :evaluated_example_count, :int32, 6
|
22
|
+
oneof :metrics do
|
23
|
+
optional :classification_evaluation_metrics, :message, 8, "google.cloud.automl.v1.ClassificationEvaluationMetrics"
|
24
|
+
optional :translation_evaluation_metrics, :message, 9, "google.cloud.automl.v1.TranslationEvaluationMetrics"
|
25
|
+
optional :image_object_detection_evaluation_metrics, :message, 12, "google.cloud.automl.v1.ImageObjectDetectionEvaluationMetrics"
|
26
|
+
optional :text_sentiment_evaluation_metrics, :message, 11, "google.cloud.automl.v1.TextSentimentEvaluationMetrics"
|
27
|
+
optional :text_extraction_evaluation_metrics, :message, 13, "google.cloud.automl.v1.TextExtractionEvaluationMetrics"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module Google
|
34
|
+
module Cloud
|
35
|
+
module AutoML
|
36
|
+
module V1
|
37
|
+
ModelEvaluation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ModelEvaluation").msgclass
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/automl/v1/model.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
require 'google/cloud/automl/v1/image_pb'
|
8
|
+
require 'google/cloud/automl/v1/text_pb'
|
9
|
+
require 'google/cloud/automl/v1/translation_pb'
|
10
|
+
require 'google/protobuf/timestamp_pb'
|
11
|
+
require 'google/api/annotations_pb'
|
12
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
13
|
+
add_file("google/cloud/automl/v1/model.proto", :syntax => :proto3) do
|
14
|
+
add_message "google.cloud.automl.v1.Model" do
|
15
|
+
optional :name, :string, 1
|
16
|
+
optional :display_name, :string, 2
|
17
|
+
optional :dataset_id, :string, 3
|
18
|
+
optional :create_time, :message, 7, "google.protobuf.Timestamp"
|
19
|
+
optional :update_time, :message, 11, "google.protobuf.Timestamp"
|
20
|
+
optional :deployment_state, :enum, 8, "google.cloud.automl.v1.Model.DeploymentState"
|
21
|
+
optional :etag, :string, 10
|
22
|
+
map :labels, :string, :string, 34
|
23
|
+
oneof :model_metadata do
|
24
|
+
optional :translation_model_metadata, :message, 15, "google.cloud.automl.v1.TranslationModelMetadata"
|
25
|
+
optional :image_classification_model_metadata, :message, 13, "google.cloud.automl.v1.ImageClassificationModelMetadata"
|
26
|
+
optional :text_classification_model_metadata, :message, 14, "google.cloud.automl.v1.TextClassificationModelMetadata"
|
27
|
+
optional :image_object_detection_model_metadata, :message, 20, "google.cloud.automl.v1.ImageObjectDetectionModelMetadata"
|
28
|
+
optional :text_extraction_model_metadata, :message, 19, "google.cloud.automl.v1.TextExtractionModelMetadata"
|
29
|
+
optional :text_sentiment_model_metadata, :message, 22, "google.cloud.automl.v1.TextSentimentModelMetadata"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
add_enum "google.cloud.automl.v1.Model.DeploymentState" do
|
33
|
+
value :DEPLOYMENT_STATE_UNSPECIFIED, 0
|
34
|
+
value :DEPLOYED, 1
|
35
|
+
value :UNDEPLOYED, 2
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Google
|
41
|
+
module Cloud
|
42
|
+
module AutoML
|
43
|
+
module V1
|
44
|
+
Model = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.Model").msgclass
|
45
|
+
Model::DeploymentState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.Model.DeploymentState").enummodule
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/automl/v1/operations.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/cloud/automl/v1/dataset_pb'
|
7
|
+
require 'google/cloud/automl/v1/io_pb'
|
8
|
+
require 'google/protobuf/timestamp_pb'
|
9
|
+
require 'google/rpc/status_pb'
|
10
|
+
require 'google/api/annotations_pb'
|
11
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
12
|
+
add_file("google/cloud/automl/v1/operations.proto", :syntax => :proto3) do
|
13
|
+
add_message "google.cloud.automl.v1.OperationMetadata" do
|
14
|
+
optional :progress_percent, :int32, 13
|
15
|
+
repeated :partial_failures, :message, 2, "google.rpc.Status"
|
16
|
+
optional :create_time, :message, 3, "google.protobuf.Timestamp"
|
17
|
+
optional :update_time, :message, 4, "google.protobuf.Timestamp"
|
18
|
+
oneof :details do
|
19
|
+
optional :delete_details, :message, 8, "google.cloud.automl.v1.DeleteOperationMetadata"
|
20
|
+
optional :deploy_model_details, :message, 24, "google.cloud.automl.v1.DeployModelOperationMetadata"
|
21
|
+
optional :undeploy_model_details, :message, 25, "google.cloud.automl.v1.UndeployModelOperationMetadata"
|
22
|
+
optional :create_model_details, :message, 10, "google.cloud.automl.v1.CreateModelOperationMetadata"
|
23
|
+
optional :create_dataset_details, :message, 30, "google.cloud.automl.v1.CreateDatasetOperationMetadata"
|
24
|
+
optional :import_data_details, :message, 15, "google.cloud.automl.v1.ImportDataOperationMetadata"
|
25
|
+
optional :batch_predict_details, :message, 16, "google.cloud.automl.v1.BatchPredictOperationMetadata"
|
26
|
+
optional :export_data_details, :message, 21, "google.cloud.automl.v1.ExportDataOperationMetadata"
|
27
|
+
optional :export_model_details, :message, 22, "google.cloud.automl.v1.ExportModelOperationMetadata"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
add_message "google.cloud.automl.v1.DeleteOperationMetadata" do
|
31
|
+
end
|
32
|
+
add_message "google.cloud.automl.v1.DeployModelOperationMetadata" do
|
33
|
+
end
|
34
|
+
add_message "google.cloud.automl.v1.UndeployModelOperationMetadata" do
|
35
|
+
end
|
36
|
+
add_message "google.cloud.automl.v1.CreateDatasetOperationMetadata" do
|
37
|
+
end
|
38
|
+
add_message "google.cloud.automl.v1.CreateModelOperationMetadata" do
|
39
|
+
end
|
40
|
+
add_message "google.cloud.automl.v1.ImportDataOperationMetadata" do
|
41
|
+
end
|
42
|
+
add_message "google.cloud.automl.v1.ExportDataOperationMetadata" do
|
43
|
+
optional :output_info, :message, 1, "google.cloud.automl.v1.ExportDataOperationMetadata.ExportDataOutputInfo"
|
44
|
+
end
|
45
|
+
add_message "google.cloud.automl.v1.ExportDataOperationMetadata.ExportDataOutputInfo" do
|
46
|
+
oneof :output_location do
|
47
|
+
optional :gcs_output_directory, :string, 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
add_message "google.cloud.automl.v1.BatchPredictOperationMetadata" do
|
51
|
+
optional :input_config, :message, 1, "google.cloud.automl.v1.BatchPredictInputConfig"
|
52
|
+
optional :output_info, :message, 2, "google.cloud.automl.v1.BatchPredictOperationMetadata.BatchPredictOutputInfo"
|
53
|
+
end
|
54
|
+
add_message "google.cloud.automl.v1.BatchPredictOperationMetadata.BatchPredictOutputInfo" do
|
55
|
+
oneof :output_location do
|
56
|
+
optional :gcs_output_directory, :string, 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
add_message "google.cloud.automl.v1.ExportModelOperationMetadata" do
|
60
|
+
optional :output_info, :message, 2, "google.cloud.automl.v1.ExportModelOperationMetadata.ExportModelOutputInfo"
|
61
|
+
end
|
62
|
+
add_message "google.cloud.automl.v1.ExportModelOperationMetadata.ExportModelOutputInfo" do
|
63
|
+
optional :gcs_output_directory, :string, 1
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
module Google
|
69
|
+
module Cloud
|
70
|
+
module AutoML
|
71
|
+
module V1
|
72
|
+
OperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.OperationMetadata").msgclass
|
73
|
+
DeleteOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.DeleteOperationMetadata").msgclass
|
74
|
+
DeployModelOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.DeployModelOperationMetadata").msgclass
|
75
|
+
UndeployModelOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.UndeployModelOperationMetadata").msgclass
|
76
|
+
CreateDatasetOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.CreateDatasetOperationMetadata").msgclass
|
77
|
+
CreateModelOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.CreateModelOperationMetadata").msgclass
|
78
|
+
ImportDataOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ImportDataOperationMetadata").msgclass
|
79
|
+
ExportDataOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ExportDataOperationMetadata").msgclass
|
80
|
+
ExportDataOperationMetadata::ExportDataOutputInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ExportDataOperationMetadata.ExportDataOutputInfo").msgclass
|
81
|
+
BatchPredictOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.BatchPredictOperationMetadata").msgclass
|
82
|
+
BatchPredictOperationMetadata::BatchPredictOutputInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.BatchPredictOperationMetadata.BatchPredictOutputInfo").msgclass
|
83
|
+
ExportModelOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ExportModelOperationMetadata").msgclass
|
84
|
+
ExportModelOperationMetadata::ExportModelOutputInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.automl.v1.ExportModelOperationMetadata.ExportModelOutputInfo").msgclass
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,634 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/automl/v1/prediction_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module AutoML
|
25
|
+
module V1
|
26
|
+
module PredictionService
|
27
|
+
##
|
28
|
+
# Client for the PredictionService service.
|
29
|
+
#
|
30
|
+
# AutoML Prediction API.
|
31
|
+
#
|
32
|
+
# On any input that is documented to expect a string parameter in
|
33
|
+
# snake_case or kebab-case, either of those cases is accepted.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :prediction_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the PredictionService Client class.
|
43
|
+
#
|
44
|
+
# See {Google::Cloud::AutoML::V1::PredictionService::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# ## Example
|
48
|
+
#
|
49
|
+
# To modify the configuration for all PredictionService clients:
|
50
|
+
#
|
51
|
+
# Google::Cloud::AutoML::V1::PredictionService::Client.configure do |config|
|
52
|
+
# config.timeout = 10_000
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "AutoML", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.predict.timeout = 60.0
|
72
|
+
|
73
|
+
default_config.rpcs.batch_predict.timeout = 60.0
|
74
|
+
|
75
|
+
default_config
|
76
|
+
end
|
77
|
+
yield @configure if block_given?
|
78
|
+
@configure
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Configure the PredictionService Client instance.
|
83
|
+
#
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
|
+
# should be made on {Client.configure}.
|
87
|
+
#
|
88
|
+
# See {Google::Cloud::AutoML::V1::PredictionService::Client::Configuration}
|
89
|
+
# for a description of the configuration fields.
|
90
|
+
#
|
91
|
+
# @yield [config] Configure the Client client.
|
92
|
+
# @yieldparam config [Client::Configuration]
|
93
|
+
#
|
94
|
+
# @return [Client::Configuration]
|
95
|
+
#
|
96
|
+
def configure
|
97
|
+
yield @config if block_given?
|
98
|
+
@config
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Create a new PredictionService client object.
|
103
|
+
#
|
104
|
+
# ## Examples
|
105
|
+
#
|
106
|
+
# To create a new PredictionService client with the default
|
107
|
+
# configuration:
|
108
|
+
#
|
109
|
+
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new
|
110
|
+
#
|
111
|
+
# To create a new PredictionService client with a custom
|
112
|
+
# configuration:
|
113
|
+
#
|
114
|
+
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new do |config|
|
115
|
+
# config.timeout = 10_000
|
116
|
+
# end
|
117
|
+
#
|
118
|
+
# @yield [config] Configure the PredictionService client.
|
119
|
+
# @yieldparam config [Client::Configuration]
|
120
|
+
#
|
121
|
+
def initialize
|
122
|
+
# These require statements are intentionally placed here to initialize
|
123
|
+
# the gRPC module only when it's required.
|
124
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
125
|
+
require "gapic/grpc"
|
126
|
+
require "google/cloud/automl/v1/prediction_service_services_pb"
|
127
|
+
|
128
|
+
# Create the configuration object
|
129
|
+
@config = Configuration.new Client.configure
|
130
|
+
|
131
|
+
# Yield the configuration if needed
|
132
|
+
yield @config if block_given?
|
133
|
+
|
134
|
+
# Create credentials
|
135
|
+
credentials = @config.credentials
|
136
|
+
credentials ||= Credentials.default scope: @config.scope
|
137
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
138
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
139
|
+
end
|
140
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
141
|
+
|
142
|
+
@operations_client = Operations.new do |config|
|
143
|
+
config.credentials = credentials
|
144
|
+
config.endpoint = @config.endpoint
|
145
|
+
end
|
146
|
+
|
147
|
+
@prediction_service_stub = Gapic::ServiceStub.new(
|
148
|
+
Google::Cloud::AutoML::V1::PredictionService::Stub,
|
149
|
+
credentials: credentials,
|
150
|
+
endpoint: @config.endpoint,
|
151
|
+
channel_args: @config.channel_args,
|
152
|
+
interceptors: @config.interceptors
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# Get the associated client for long-running operations.
|
158
|
+
#
|
159
|
+
# @return [Google::Cloud::AutoML::V1::PredictionService::Operations]
|
160
|
+
#
|
161
|
+
attr_reader :operations_client
|
162
|
+
|
163
|
+
# Service calls
|
164
|
+
|
165
|
+
##
|
166
|
+
# Perform an online prediction. The prediction result is directly
|
167
|
+
# returned in the response.
|
168
|
+
# Available for following ML scenarios, and their expected request payloads:
|
169
|
+
#
|
170
|
+
# <table>
|
171
|
+
# <tr>
|
172
|
+
# <td>AutoML Vision Classification</td>
|
173
|
+
# <td>An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB.</td>
|
174
|
+
# </tr>
|
175
|
+
# <tr>
|
176
|
+
# <td>AutoML Vision Object Detection</td>
|
177
|
+
# <td>An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB.</td>
|
178
|
+
# </tr>
|
179
|
+
# <tr>
|
180
|
+
# <td>AutoML Natural Language Classification</td>
|
181
|
+
# <td>A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in
|
182
|
+
# .PDF, .TIF or .TIFF format with size upto 2MB.</td>
|
183
|
+
# </tr>
|
184
|
+
# <tr>
|
185
|
+
# <td>AutoML Natural Language Entity Extraction</td>
|
186
|
+
# <td>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.</td>
|
188
|
+
# </tr>
|
189
|
+
# <tr>
|
190
|
+
# <td>AutoML Natural Language Sentiment Analysis</td>
|
191
|
+
# <td>A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in
|
192
|
+
# .PDF, .TIF or .TIFF format with size upto 2MB.</td>
|
193
|
+
# </tr>
|
194
|
+
# <tr>
|
195
|
+
# <td>AutoML Translation</td>
|
196
|
+
# <td>A TextSnippet up to 25,000 characters, UTF-8 encoded.</td>
|
197
|
+
# </tr>
|
198
|
+
# <tr>
|
199
|
+
# <td>AutoML Tables</td>
|
200
|
+
# <td>A row with column values matching
|
201
|
+
# the columns of the model, up to 5MB. Not available for FORECASTING
|
202
|
+
# `prediction_type`.
|
203
|
+
# </td>
|
204
|
+
# </tr>
|
205
|
+
# </table>
|
206
|
+
#
|
207
|
+
# @overload predict(request, options = nil)
|
208
|
+
# Pass arguments to `predict` via a request object, either of type
|
209
|
+
# {Google::Cloud::AutoML::V1::PredictRequest} or an equivalent Hash.
|
210
|
+
#
|
211
|
+
# @param request [Google::Cloud::AutoML::V1::PredictRequest, Hash]
|
212
|
+
# A request object representing the call parameters. Required. To specify no
|
213
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
214
|
+
# @param options [Gapic::CallOptions, Hash]
|
215
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
216
|
+
#
|
217
|
+
# @overload predict(name: nil, payload: nil, params: nil)
|
218
|
+
# Pass arguments to `predict` via keyword arguments. Note that at
|
219
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
220
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
221
|
+
#
|
222
|
+
# @param name [String]
|
223
|
+
# Required. Name of the model requested to serve the prediction.
|
224
|
+
# @param payload [Google::Cloud::AutoML::V1::ExamplePayload, Hash]
|
225
|
+
# Required. Payload to perform a prediction on. The payload must match the
|
226
|
+
# problem type that the model was trained to solve.
|
227
|
+
# @param params [Hash{String => String}]
|
228
|
+
# Additional domain-specific parameters, any string must be up to 25000
|
229
|
+
# characters long.
|
230
|
+
#
|
231
|
+
# <h4>AutoML Vision Classification</h4>
|
232
|
+
#
|
233
|
+
# `score_threshold`
|
234
|
+
# : (float) A value from 0.0 to 1.0. When the model
|
235
|
+
# makes predictions for an image, it will only produce results that have
|
236
|
+
# at least this confidence score. The default is 0.5.
|
237
|
+
#
|
238
|
+
# <h4>AutoML Vision Object Detection</h4>
|
239
|
+
#
|
240
|
+
# `score_threshold`
|
241
|
+
# : (float) When Model detects objects on the image,
|
242
|
+
# it will only produce bounding boxes which have at least this
|
243
|
+
# confidence score. Value in 0 to 1 range, default is 0.5.
|
244
|
+
#
|
245
|
+
# `max_bounding_box_count`
|
246
|
+
# : (int64) The maximum number of bounding
|
247
|
+
# boxes returned. The default is 100. The
|
248
|
+
# number of returned bounding boxes might be limited by the server.
|
249
|
+
#
|
250
|
+
# <h4>AutoML Tables</h4>
|
251
|
+
#
|
252
|
+
# `feature_importance`
|
253
|
+
# : (boolean) Whether
|
254
|
+
#
|
255
|
+
# [feature_importance][google.cloud.automl.v1.TablesModelColumnInfo.feature_importance]
|
256
|
+
# is populated in the returned list of
|
257
|
+
# [TablesAnnotation][google.cloud.automl.v1.TablesAnnotation]
|
258
|
+
# objects. The default is false.
|
259
|
+
#
|
260
|
+
# @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]
|
263
|
+
#
|
264
|
+
# @return [Google::Cloud::AutoML::V1::PredictResponse]
|
265
|
+
#
|
266
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
267
|
+
#
|
268
|
+
def predict request, options = nil
|
269
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
270
|
+
|
271
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::AutoML::V1::PredictRequest
|
272
|
+
|
273
|
+
# Converts hash and nil to an options object
|
274
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
275
|
+
|
276
|
+
# Customize the options with defaults
|
277
|
+
metadata = @config.rpcs.predict.metadata.to_h
|
278
|
+
|
279
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
280
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
281
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
282
|
+
gapic_version: ::Google::Cloud::Automl::V1::VERSION
|
283
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
284
|
+
|
285
|
+
header_params = {
|
286
|
+
"name" => request.name
|
287
|
+
}
|
288
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
289
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
290
|
+
|
291
|
+
options.apply_defaults timeout: @config.rpcs.predict.timeout,
|
292
|
+
metadata: metadata,
|
293
|
+
retry_policy: @config.rpcs.predict.retry_policy
|
294
|
+
options.apply_defaults metadata: @config.metadata,
|
295
|
+
retry_policy: @config.retry_policy
|
296
|
+
|
297
|
+
@prediction_service_stub.call_rpc :predict, request, options: options do |response, operation|
|
298
|
+
yield response, operation if block_given?
|
299
|
+
return response
|
300
|
+
end
|
301
|
+
rescue GRPC::BadStatus => e
|
302
|
+
raise Google::Cloud::Error.from_error(e)
|
303
|
+
end
|
304
|
+
|
305
|
+
##
|
306
|
+
# Perform a batch prediction. Unlike the online {Google::Cloud::AutoML::V1::PredictionService::Client#predict Predict}, batch
|
307
|
+
# prediction result won't be immediately available in the response. Instead,
|
308
|
+
# a long running operation object is returned. User can poll the operation
|
309
|
+
# 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.
|
312
|
+
# Available for following ML scenarios:
|
313
|
+
#
|
314
|
+
# * AutoML Vision Classification
|
315
|
+
# * AutoML Vision Object Detection
|
316
|
+
# * AutoML Video Intelligence Classification
|
317
|
+
# * AutoML Video Intelligence Object Tracking * AutoML Natural Language Classification
|
318
|
+
# * AutoML Natural Language Entity Extraction
|
319
|
+
# * AutoML Natural Language Sentiment Analysis
|
320
|
+
# * AutoML Tables
|
321
|
+
#
|
322
|
+
# @overload batch_predict(request, options = nil)
|
323
|
+
# Pass arguments to `batch_predict` via a request object, either of type
|
324
|
+
# {Google::Cloud::AutoML::V1::BatchPredictRequest} or an equivalent Hash.
|
325
|
+
#
|
326
|
+
# @param request [Google::Cloud::AutoML::V1::BatchPredictRequest, Hash]
|
327
|
+
# A request object representing the call parameters. Required. To specify no
|
328
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
329
|
+
# @param options [Gapic::CallOptions, Hash]
|
330
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
331
|
+
#
|
332
|
+
# @overload batch_predict(name: nil, input_config: nil, output_config: nil, params: nil)
|
333
|
+
# Pass arguments to `batch_predict` via keyword arguments. Note that at
|
334
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
335
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
336
|
+
#
|
337
|
+
# @param name [String]
|
338
|
+
# Required. Name of the model requested to serve the batch prediction.
|
339
|
+
# @param input_config [Google::Cloud::AutoML::V1::BatchPredictInputConfig, Hash]
|
340
|
+
# Required. The input configuration for batch prediction.
|
341
|
+
# @param output_config [Google::Cloud::AutoML::V1::BatchPredictOutputConfig, Hash]
|
342
|
+
# Required. The Configuration specifying where output predictions should
|
343
|
+
# be written.
|
344
|
+
# @param params [Hash{String => String}]
|
345
|
+
# Additional domain-specific parameters for the predictions, any string must
|
346
|
+
# be up to 25000 characters long.
|
347
|
+
#
|
348
|
+
# <h4>AutoML Natural Language Classification</h4>
|
349
|
+
#
|
350
|
+
# `score_threshold`
|
351
|
+
# : (float) A value from 0.0 to 1.0. When the model
|
352
|
+
# makes predictions for a text snippet, it will only produce results
|
353
|
+
# that have at least this confidence score. The default is 0.5.
|
354
|
+
#
|
355
|
+
#
|
356
|
+
# <h4>AutoML Vision Classification</h4>
|
357
|
+
#
|
358
|
+
# `score_threshold`
|
359
|
+
# : (float) A value from 0.0 to 1.0. When the model
|
360
|
+
# makes predictions for an image, it will only produce results that
|
361
|
+
# have at least this confidence score. The default is 0.5.
|
362
|
+
#
|
363
|
+
# <h4>AutoML Vision Object Detection</h4>
|
364
|
+
#
|
365
|
+
# `score_threshold`
|
366
|
+
# : (float) When Model detects objects on the image,
|
367
|
+
# it will only produce bounding boxes which have at least this
|
368
|
+
# confidence score. Value in 0 to 1 range, default is 0.5.
|
369
|
+
#
|
370
|
+
# `max_bounding_box_count`
|
371
|
+
# : (int64) The maximum number of bounding
|
372
|
+
# boxes returned per image. The default is 100, the
|
373
|
+
# number of bounding boxes returned might be limited by the server.
|
374
|
+
# <h4>AutoML Video Intelligence Classification</h4>
|
375
|
+
#
|
376
|
+
# `score_threshold`
|
377
|
+
# : (float) A value from 0.0 to 1.0. When the model
|
378
|
+
# makes predictions for a video, it will only produce results that
|
379
|
+
# have at least this confidence score. The default is 0.5.
|
380
|
+
#
|
381
|
+
# `segment_classification`
|
382
|
+
# : (boolean) Set to true to request
|
383
|
+
# segment-level classification. AutoML Video Intelligence returns
|
384
|
+
# labels and their confidence scores for the entire segment of the
|
385
|
+
# video that user specified in the request configuration.
|
386
|
+
# The default is true.
|
387
|
+
#
|
388
|
+
# `shot_classification`
|
389
|
+
# : (boolean) Set to true to request shot-level
|
390
|
+
# classification. AutoML Video Intelligence determines the boundaries
|
391
|
+
# for each camera shot in the entire segment of the video that user
|
392
|
+
# specified in the request configuration. AutoML Video Intelligence
|
393
|
+
# then returns labels and their confidence scores for each detected
|
394
|
+
# shot, along with the start and end time of the shot.
|
395
|
+
# The default is false.
|
396
|
+
#
|
397
|
+
# WARNING: Model evaluation is not done for this classification type,
|
398
|
+
# the quality of it depends on training data, but there are no metrics
|
399
|
+
# provided to describe that quality.
|
400
|
+
#
|
401
|
+
# `1s_interval_classification`
|
402
|
+
# : (boolean) Set to true to request
|
403
|
+
# classification for a video at one-second intervals. AutoML Video
|
404
|
+
# Intelligence returns labels and their confidence scores for each
|
405
|
+
# second of the entire segment of the video that user specified in the
|
406
|
+
# request configuration. The default is false.
|
407
|
+
#
|
408
|
+
# WARNING: Model evaluation is not done for this classification
|
409
|
+
# type, the quality of it depends on training data, but there are no
|
410
|
+
# metrics provided to describe that quality.
|
411
|
+
#
|
412
|
+
# <h4>AutoML Video Intelligence Object Tracking</h4>
|
413
|
+
#
|
414
|
+
# `score_threshold`
|
415
|
+
# : (float) When Model detects objects on video frames,
|
416
|
+
# it will only produce bounding boxes which have at least this
|
417
|
+
# confidence score. Value in 0 to 1 range, default is 0.5.
|
418
|
+
#
|
419
|
+
# `max_bounding_box_count`
|
420
|
+
# : (int64) The maximum number of bounding
|
421
|
+
# boxes returned per image. The default is 100, the
|
422
|
+
# number of bounding boxes returned might be limited by the server.
|
423
|
+
#
|
424
|
+
# `min_bounding_box_size`
|
425
|
+
# : (float) Only bounding boxes with shortest edge
|
426
|
+
# at least that long as a relative value of video frame size are
|
427
|
+
# returned. Value in 0 to 1 range. Default is 0.
|
428
|
+
#
|
429
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
430
|
+
# @yieldparam response [Gapic::Operation]
|
431
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
432
|
+
#
|
433
|
+
# @return [Gapic::Operation]
|
434
|
+
#
|
435
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
436
|
+
#
|
437
|
+
def batch_predict request, options = nil
|
438
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
439
|
+
|
440
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::AutoML::V1::BatchPredictRequest
|
441
|
+
|
442
|
+
# Converts hash and nil to an options object
|
443
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
444
|
+
|
445
|
+
# Customize the options with defaults
|
446
|
+
metadata = @config.rpcs.batch_predict.metadata.to_h
|
447
|
+
|
448
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
449
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
450
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
451
|
+
gapic_version: ::Google::Cloud::Automl::V1::VERSION
|
452
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
453
|
+
|
454
|
+
header_params = {
|
455
|
+
"name" => request.name
|
456
|
+
}
|
457
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
458
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
459
|
+
|
460
|
+
options.apply_defaults timeout: @config.rpcs.batch_predict.timeout,
|
461
|
+
metadata: metadata,
|
462
|
+
retry_policy: @config.rpcs.batch_predict.retry_policy
|
463
|
+
options.apply_defaults metadata: @config.metadata,
|
464
|
+
retry_policy: @config.retry_policy
|
465
|
+
|
466
|
+
@prediction_service_stub.call_rpc :batch_predict, request, options: options do |response, operation|
|
467
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
468
|
+
yield response, operation if block_given?
|
469
|
+
return response
|
470
|
+
end
|
471
|
+
rescue GRPC::BadStatus => e
|
472
|
+
raise Google::Cloud::Error.from_error(e)
|
473
|
+
end
|
474
|
+
|
475
|
+
##
|
476
|
+
# Configuration class for the PredictionService API.
|
477
|
+
#
|
478
|
+
# This class represents the configuration for PredictionService,
|
479
|
+
# providing control over timeouts, retry behavior, logging, transport
|
480
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
481
|
+
# applied individually to specific RPCs. See
|
482
|
+
# {Google::Cloud::AutoML::V1::PredictionService::Client::Configuration::Rpcs}
|
483
|
+
# for a list of RPCs that can be configured independently.
|
484
|
+
#
|
485
|
+
# Configuration can be applied globally to all clients, or to a single client
|
486
|
+
# on construction.
|
487
|
+
#
|
488
|
+
# # Examples
|
489
|
+
#
|
490
|
+
# To modify the global config, setting the timeout for predict
|
491
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
492
|
+
#
|
493
|
+
# Google::Cloud::AutoML::V1::PredictionService::Client.configure do |config|
|
494
|
+
# config.timeout = 10_000
|
495
|
+
# config.rpcs.predict.timeout = 20_000
|
496
|
+
# end
|
497
|
+
#
|
498
|
+
# To apply the above configuration only to a new client:
|
499
|
+
#
|
500
|
+
# client = Google::Cloud::AutoML::V1::PredictionService::Client.new do |config|
|
501
|
+
# config.timeout = 10_000
|
502
|
+
# config.rpcs.predict.timeout = 20_000
|
503
|
+
# end
|
504
|
+
#
|
505
|
+
# @!attribute [rw] endpoint
|
506
|
+
# The hostname or hostname:port of the service endpoint.
|
507
|
+
# Defaults to `"automl.googleapis.com"`.
|
508
|
+
# @return [String]
|
509
|
+
# @!attribute [rw] credentials
|
510
|
+
# Credentials to send with calls. You may provide any of the following types:
|
511
|
+
# * (`String`) The path to a service account key file in JSON format
|
512
|
+
# * (`Hash`) A service account key as a Hash
|
513
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
514
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
515
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
516
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
517
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
518
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
519
|
+
# * (`nil`) indicating no credentials
|
520
|
+
# @return [Object]
|
521
|
+
# @!attribute [rw] scope
|
522
|
+
# The OAuth scopes
|
523
|
+
# @return [Array<String>]
|
524
|
+
# @!attribute [rw] lib_name
|
525
|
+
# The library name as recorded in instrumentation and logging
|
526
|
+
# @return [String]
|
527
|
+
# @!attribute [rw] lib_version
|
528
|
+
# The library version as recorded in instrumentation and logging
|
529
|
+
# @return [String]
|
530
|
+
# @!attribute [rw] channel_args
|
531
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
532
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
533
|
+
# @return [Hash]
|
534
|
+
# @!attribute [rw] interceptors
|
535
|
+
# An array of interceptors that are run before calls are executed.
|
536
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
537
|
+
# @!attribute [rw] timeout
|
538
|
+
# The call timeout in milliseconds.
|
539
|
+
# @return [Numeric]
|
540
|
+
# @!attribute [rw] metadata
|
541
|
+
# Additional gRPC headers to be sent with the call.
|
542
|
+
# @return [Hash{Symbol=>String}]
|
543
|
+
# @!attribute [rw] retry_policy
|
544
|
+
# The retry policy. The value is a hash with the following keys:
|
545
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
546
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
547
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
548
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
549
|
+
# trigger a retry.
|
550
|
+
# @return [Hash]
|
551
|
+
#
|
552
|
+
class Configuration
|
553
|
+
extend Gapic::Config
|
554
|
+
|
555
|
+
config_attr :endpoint, "automl.googleapis.com", String
|
556
|
+
config_attr :credentials, nil do |value|
|
557
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
558
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
559
|
+
allowed.any? { |klass| klass === value }
|
560
|
+
end
|
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
|
+
|
570
|
+
# @private
|
571
|
+
def initialize parent_config = nil
|
572
|
+
@parent_config = parent_config unless parent_config.nil?
|
573
|
+
|
574
|
+
yield self if block_given?
|
575
|
+
end
|
576
|
+
|
577
|
+
##
|
578
|
+
# Configurations for individual RPCs
|
579
|
+
# @return [Rpcs]
|
580
|
+
#
|
581
|
+
def rpcs
|
582
|
+
@rpcs ||= begin
|
583
|
+
parent_rpcs = nil
|
584
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
585
|
+
Rpcs.new parent_rpcs
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
##
|
590
|
+
# Configuration RPC class for the PredictionService API.
|
591
|
+
#
|
592
|
+
# Includes fields providing the configuration for each RPC in this service.
|
593
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
594
|
+
# the following configuration fields:
|
595
|
+
#
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
597
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
598
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
599
|
+
# include the following keys:
|
600
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
601
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
602
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
603
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
604
|
+
# trigger a retry.
|
605
|
+
#
|
606
|
+
class Rpcs
|
607
|
+
##
|
608
|
+
# RPC-specific configuration for `predict`
|
609
|
+
# @return [Gapic::Config::Method]
|
610
|
+
#
|
611
|
+
attr_reader :predict
|
612
|
+
##
|
613
|
+
# RPC-specific configuration for `batch_predict`
|
614
|
+
# @return [Gapic::Config::Method]
|
615
|
+
#
|
616
|
+
attr_reader :batch_predict
|
617
|
+
|
618
|
+
# @private
|
619
|
+
def initialize parent_rpcs = nil
|
620
|
+
predict_config = parent_rpcs&.predict if parent_rpcs&.respond_to? :predict
|
621
|
+
@predict = Gapic::Config::Method.new predict_config
|
622
|
+
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
|
+
|
625
|
+
yield self if block_given?
|
626
|
+
end
|
627
|
+
end
|
628
|
+
end
|
629
|
+
end
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
end
|
634
|
+
end
|