google-cloud-vision 0.37.2 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/AUTHENTICATION.md +51 -59
- data/LICENSE.md +203 -0
- data/MIGRATING.md +343 -0
- data/README.md +94 -49
- data/lib/{google/cloud/vision/v1/doc/google/protobuf/wrappers.rb → google-cloud-vision.rb} +4 -11
- data/lib/google/cloud/vision.rb +131 -214
- data/lib/google/cloud/vision/version.rb +6 -2
- metadata +74 -102
- data/LICENSE +0 -201
- data/lib/google/cloud/vision/v1.rb +0 -249
- data/lib/google/cloud/vision/v1/credentials.rb +0 -42
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -923
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -115
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -569
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
- data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/vision/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -161
- data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
- data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -516
- data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -46
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -344
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -74
- data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1490
- data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -121
- data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -54
- data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -207
- data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -233
- data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
- data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
- data/lib/google/cloud/vision/v1p3beta1.rb +0 -253
- data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -156
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -538
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -255
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
- data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -26
- data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -161
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
- data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -312
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -304
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -55
- data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1419
- data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
- data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -64
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -191
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -226
- data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
- data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
@@ -1,94 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# source: google/cloud/vision/v1/text_annotation.proto
|
3
|
-
|
4
|
-
|
5
|
-
require 'google/protobuf'
|
6
|
-
|
7
|
-
require 'google/cloud/vision/v1/geometry_pb'
|
8
|
-
require 'google/api/annotations_pb'
|
9
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
-
add_message "google.cloud.vision.v1.TextAnnotation" do
|
11
|
-
repeated :pages, :message, 1, "google.cloud.vision.v1.Page"
|
12
|
-
optional :text, :string, 2
|
13
|
-
end
|
14
|
-
add_message "google.cloud.vision.v1.TextAnnotation.DetectedLanguage" do
|
15
|
-
optional :language_code, :string, 1
|
16
|
-
optional :confidence, :float, 2
|
17
|
-
end
|
18
|
-
add_message "google.cloud.vision.v1.TextAnnotation.DetectedBreak" do
|
19
|
-
optional :type, :enum, 1, "google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType"
|
20
|
-
optional :is_prefix, :bool, 2
|
21
|
-
end
|
22
|
-
add_enum "google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType" do
|
23
|
-
value :UNKNOWN, 0
|
24
|
-
value :SPACE, 1
|
25
|
-
value :SURE_SPACE, 2
|
26
|
-
value :EOL_SURE_SPACE, 3
|
27
|
-
value :HYPHEN, 4
|
28
|
-
value :LINE_BREAK, 5
|
29
|
-
end
|
30
|
-
add_message "google.cloud.vision.v1.TextAnnotation.TextProperty" do
|
31
|
-
repeated :detected_languages, :message, 1, "google.cloud.vision.v1.TextAnnotation.DetectedLanguage"
|
32
|
-
optional :detected_break, :message, 2, "google.cloud.vision.v1.TextAnnotation.DetectedBreak"
|
33
|
-
end
|
34
|
-
add_message "google.cloud.vision.v1.Page" do
|
35
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
36
|
-
optional :width, :int32, 2
|
37
|
-
optional :height, :int32, 3
|
38
|
-
repeated :blocks, :message, 4, "google.cloud.vision.v1.Block"
|
39
|
-
optional :confidence, :float, 5
|
40
|
-
end
|
41
|
-
add_message "google.cloud.vision.v1.Block" do
|
42
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
43
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
44
|
-
repeated :paragraphs, :message, 3, "google.cloud.vision.v1.Paragraph"
|
45
|
-
optional :block_type, :enum, 4, "google.cloud.vision.v1.Block.BlockType"
|
46
|
-
optional :confidence, :float, 5
|
47
|
-
end
|
48
|
-
add_enum "google.cloud.vision.v1.Block.BlockType" do
|
49
|
-
value :UNKNOWN, 0
|
50
|
-
value :TEXT, 1
|
51
|
-
value :TABLE, 2
|
52
|
-
value :PICTURE, 3
|
53
|
-
value :RULER, 4
|
54
|
-
value :BARCODE, 5
|
55
|
-
end
|
56
|
-
add_message "google.cloud.vision.v1.Paragraph" do
|
57
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
58
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
59
|
-
repeated :words, :message, 3, "google.cloud.vision.v1.Word"
|
60
|
-
optional :confidence, :float, 4
|
61
|
-
end
|
62
|
-
add_message "google.cloud.vision.v1.Word" do
|
63
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
64
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
65
|
-
repeated :symbols, :message, 3, "google.cloud.vision.v1.Symbol"
|
66
|
-
optional :confidence, :float, 4
|
67
|
-
end
|
68
|
-
add_message "google.cloud.vision.v1.Symbol" do
|
69
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
70
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
71
|
-
optional :text, :string, 3
|
72
|
-
optional :confidence, :float, 4
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
module Google
|
77
|
-
module Cloud
|
78
|
-
module Vision
|
79
|
-
module V1
|
80
|
-
TextAnnotation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation").msgclass
|
81
|
-
TextAnnotation::DetectedLanguage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedLanguage").msgclass
|
82
|
-
TextAnnotation::DetectedBreak = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedBreak").msgclass
|
83
|
-
TextAnnotation::DetectedBreak::BreakType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType").enummodule
|
84
|
-
TextAnnotation::TextProperty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.TextProperty").msgclass
|
85
|
-
Page = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Page").msgclass
|
86
|
-
Block = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Block").msgclass
|
87
|
-
Block::BlockType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Block.BlockType").enummodule
|
88
|
-
Paragraph = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Paragraph").msgclass
|
89
|
-
Word = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Word").msgclass
|
90
|
-
Symbol = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Symbol").msgclass
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# source: google/cloud/vision/v1/web_detection.proto
|
3
|
-
|
4
|
-
|
5
|
-
require 'google/protobuf'
|
6
|
-
|
7
|
-
require 'google/api/annotations_pb'
|
8
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_message "google.cloud.vision.v1.WebDetection" do
|
10
|
-
repeated :web_entities, :message, 1, "google.cloud.vision.v1.WebDetection.WebEntity"
|
11
|
-
repeated :full_matching_images, :message, 2, "google.cloud.vision.v1.WebDetection.WebImage"
|
12
|
-
repeated :partial_matching_images, :message, 3, "google.cloud.vision.v1.WebDetection.WebImage"
|
13
|
-
repeated :pages_with_matching_images, :message, 4, "google.cloud.vision.v1.WebDetection.WebPage"
|
14
|
-
repeated :visually_similar_images, :message, 6, "google.cloud.vision.v1.WebDetection.WebImage"
|
15
|
-
repeated :best_guess_labels, :message, 8, "google.cloud.vision.v1.WebDetection.WebLabel"
|
16
|
-
end
|
17
|
-
add_message "google.cloud.vision.v1.WebDetection.WebEntity" do
|
18
|
-
optional :entity_id, :string, 1
|
19
|
-
optional :score, :float, 2
|
20
|
-
optional :description, :string, 3
|
21
|
-
end
|
22
|
-
add_message "google.cloud.vision.v1.WebDetection.WebImage" do
|
23
|
-
optional :url, :string, 1
|
24
|
-
optional :score, :float, 2
|
25
|
-
end
|
26
|
-
add_message "google.cloud.vision.v1.WebDetection.WebPage" do
|
27
|
-
optional :url, :string, 1
|
28
|
-
optional :score, :float, 2
|
29
|
-
optional :page_title, :string, 3
|
30
|
-
repeated :full_matching_images, :message, 4, "google.cloud.vision.v1.WebDetection.WebImage"
|
31
|
-
repeated :partial_matching_images, :message, 5, "google.cloud.vision.v1.WebDetection.WebImage"
|
32
|
-
end
|
33
|
-
add_message "google.cloud.vision.v1.WebDetection.WebLabel" do
|
34
|
-
optional :label, :string, 1
|
35
|
-
optional :language_code, :string, 2
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module Google
|
40
|
-
module Cloud
|
41
|
-
module Vision
|
42
|
-
module V1
|
43
|
-
WebDetection = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection").msgclass
|
44
|
-
WebDetection::WebEntity = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebEntity").msgclass
|
45
|
-
WebDetection::WebImage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebImage").msgclass
|
46
|
-
WebDetection::WebPage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebPage").msgclass
|
47
|
-
WebDetection::WebLabel = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebLabel").msgclass
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,253 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
require "google/cloud/vision/v1p3beta1/product_search_client"
|
17
|
-
require "google/cloud/vision/v1p3beta1/image_annotator_client"
|
18
|
-
require "google/cloud/vision/v1p3beta1/helpers"
|
19
|
-
require "google/cloud/vision/v1p3beta1/image_annotator_pb"
|
20
|
-
require "google/cloud/vision/v1p3beta1/product_search_service_pb"
|
21
|
-
|
22
|
-
module Google
|
23
|
-
module Cloud
|
24
|
-
module Vision
|
25
|
-
# rubocop:disable LineLength
|
26
|
-
|
27
|
-
##
|
28
|
-
# # Ruby Client for Cloud Vision API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
29
|
-
#
|
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.
|
34
|
-
# - [Product Documentation][]
|
35
|
-
#
|
36
|
-
# ## Quick Start
|
37
|
-
# In order to use this library, you first need to go through the following
|
38
|
-
# steps:
|
39
|
-
#
|
40
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
41
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
42
|
-
# 3. [Enable the Cloud Vision API.](https://console.cloud.google.com/apis/library/vision.googleapis.com)
|
43
|
-
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-vision/latest/file.AUTHENTICATION.html)
|
44
|
-
#
|
45
|
-
# ### Installation
|
46
|
-
# ```
|
47
|
-
# $ gem install google-cloud-vision
|
48
|
-
# ```
|
49
|
-
#
|
50
|
-
# ### Preview
|
51
|
-
# #### ImageAnnotatorClient
|
52
|
-
# ```rb
|
53
|
-
# require "google/cloud/vision"
|
54
|
-
#
|
55
|
-
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1p3beta1)
|
56
|
-
# gcs_image_uri = "gs://cloud-samples-data/vision/face_detection/celebrity_recognition/sergey.jpg"
|
57
|
-
# source = { gcs_image_uri: gcs_image_uri }
|
58
|
-
# image = { source: source }
|
59
|
-
# type = :FACE_DETECTION
|
60
|
-
# features_element = { type: type }
|
61
|
-
# features = [features_element]
|
62
|
-
# requests_element = { image: image, features: features }
|
63
|
-
# requests = [requests_element]
|
64
|
-
# response = image_annotator_client.batch_annotate_images(requests)
|
65
|
-
# ```
|
66
|
-
#
|
67
|
-
# ### Next Steps
|
68
|
-
# - Read the [Cloud Vision API Product documentation][Product Documentation]
|
69
|
-
# to learn more about the product and see How-to Guides.
|
70
|
-
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
71
|
-
# to see the full list of Cloud APIs that we cover.
|
72
|
-
#
|
73
|
-
# [Product Documentation]: https://cloud.google.com/vision
|
74
|
-
#
|
75
|
-
# ## Enabling Logging
|
76
|
-
#
|
77
|
-
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
78
|
-
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
79
|
-
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
80
|
-
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
81
|
-
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
82
|
-
#
|
83
|
-
# Configuring a Ruby stdlib logger:
|
84
|
-
#
|
85
|
-
# ```ruby
|
86
|
-
# require "logger"
|
87
|
-
#
|
88
|
-
# module MyLogger
|
89
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
90
|
-
# def logger
|
91
|
-
# LOGGER
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
#
|
95
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
96
|
-
# module GRPC
|
97
|
-
# extend MyLogger
|
98
|
-
# end
|
99
|
-
# ```
|
100
|
-
#
|
101
|
-
module V1p3beta1
|
102
|
-
# rubocop:enable LineLength
|
103
|
-
|
104
|
-
module ProductSearch
|
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
|
110
|
-
# {Google::Cloud::Vision::V1p3beta1::ProductSet ProductSet} resources, named
|
111
|
-
# `projects/*/locations/*/productSets/*`, which acts as a way to put different
|
112
|
-
# products into groups to limit identification.
|
113
|
-
#
|
114
|
-
# In parallel,
|
115
|
-
#
|
116
|
-
# * The API has a collection of
|
117
|
-
# {Google::Cloud::Vision::V1p3beta1::Product Product} resources, named
|
118
|
-
# `projects/*/locations/*/products/*`
|
119
|
-
#
|
120
|
-
# * Each {Google::Cloud::Vision::V1p3beta1::Product Product} has a collection of
|
121
|
-
# {Google::Cloud::Vision::V1p3beta1::ReferenceImage ReferenceImage} resources,
|
122
|
-
# named
|
123
|
-
# `projects/*/locations/*/products/*/referenceImages/*`
|
124
|
-
#
|
125
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
126
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
127
|
-
# be many types.
|
128
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
129
|
-
# authenticating requests made by this client.
|
130
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
131
|
-
# credentials for this client.
|
132
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
133
|
-
# credentials for this client.
|
134
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
135
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
136
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
137
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
138
|
-
# metadata for requests, generally, to give OAuth credentials.
|
139
|
-
# @param scopes [Array<String>]
|
140
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
141
|
-
# an updater_proc is supplied.
|
142
|
-
# @param client_config [Hash]
|
143
|
-
# A Hash for call options for each method. See
|
144
|
-
# Google::Gax#construct_settings for the structure of
|
145
|
-
# this data. Falls back to the default config if not specified
|
146
|
-
# or the specified config is missing data points.
|
147
|
-
# @param timeout [Numeric]
|
148
|
-
# The default timeout, in seconds, for calls made through this client.
|
149
|
-
# @param metadata [Hash]
|
150
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
151
|
-
# @param service_address [String]
|
152
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
153
|
-
# @param service_port [Integer]
|
154
|
-
# Override for the service port, or `nil` to leave as the default.
|
155
|
-
# @param exception_transformer [Proc]
|
156
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
157
|
-
# custom error handling.
|
158
|
-
def self.new \
|
159
|
-
credentials: nil,
|
160
|
-
scopes: nil,
|
161
|
-
client_config: nil,
|
162
|
-
timeout: nil,
|
163
|
-
metadata: nil,
|
164
|
-
service_address: nil,
|
165
|
-
service_port: nil,
|
166
|
-
exception_transformer: nil,
|
167
|
-
lib_name: nil,
|
168
|
-
lib_version: nil
|
169
|
-
kwargs = {
|
170
|
-
credentials: credentials,
|
171
|
-
scopes: scopes,
|
172
|
-
client_config: client_config,
|
173
|
-
timeout: timeout,
|
174
|
-
metadata: metadata,
|
175
|
-
exception_transformer: exception_transformer,
|
176
|
-
lib_name: lib_name,
|
177
|
-
service_address: service_address,
|
178
|
-
service_port: service_port,
|
179
|
-
lib_version: lib_version
|
180
|
-
}.select { |_, v| v != nil }
|
181
|
-
Google::Cloud::Vision::V1p3beta1::ProductSearchClient.new(**kwargs)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
module ImageAnnotator
|
186
|
-
##
|
187
|
-
# Service that performs Google Cloud Vision API detection tasks over client
|
188
|
-
# images, such as face, landmark, logo, label, and text detection. The
|
189
|
-
# ImageAnnotator service returns detected entities from the images.
|
190
|
-
#
|
191
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
192
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
193
|
-
# be many types.
|
194
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
195
|
-
# authenticating requests made by this client.
|
196
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
197
|
-
# credentials for this client.
|
198
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
199
|
-
# credentials for this client.
|
200
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
201
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
202
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
203
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
204
|
-
# metadata for requests, generally, to give OAuth credentials.
|
205
|
-
# @param scopes [Array<String>]
|
206
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
207
|
-
# an updater_proc is supplied.
|
208
|
-
# @param client_config [Hash]
|
209
|
-
# A Hash for call options for each method. See
|
210
|
-
# Google::Gax#construct_settings for the structure of
|
211
|
-
# this data. Falls back to the default config if not specified
|
212
|
-
# or the specified config is missing data points.
|
213
|
-
# @param timeout [Numeric]
|
214
|
-
# The default timeout, in seconds, for calls made through this client.
|
215
|
-
# @param metadata [Hash]
|
216
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
217
|
-
# @param service_address [String]
|
218
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
219
|
-
# @param service_port [Integer]
|
220
|
-
# Override for the service port, or `nil` to leave as the default.
|
221
|
-
# @param exception_transformer [Proc]
|
222
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
223
|
-
# custom error handling.
|
224
|
-
def self.new \
|
225
|
-
credentials: nil,
|
226
|
-
scopes: nil,
|
227
|
-
client_config: nil,
|
228
|
-
timeout: nil,
|
229
|
-
metadata: nil,
|
230
|
-
service_address: nil,
|
231
|
-
service_port: nil,
|
232
|
-
exception_transformer: nil,
|
233
|
-
lib_name: nil,
|
234
|
-
lib_version: nil
|
235
|
-
kwargs = {
|
236
|
-
credentials: credentials,
|
237
|
-
scopes: scopes,
|
238
|
-
client_config: client_config,
|
239
|
-
timeout: timeout,
|
240
|
-
metadata: metadata,
|
241
|
-
exception_transformer: exception_transformer,
|
242
|
-
lib_name: lib_name,
|
243
|
-
service_address: service_address,
|
244
|
-
service_port: service_port,
|
245
|
-
lib_version: lib_version
|
246
|
-
}.select { |_, v| v != nil }
|
247
|
-
Google::Cloud::Vision::V1p3beta1::ImageAnnotatorClient.new(**kwargs)
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
require "googleauth"
|
17
|
-
|
18
|
-
module Google
|
19
|
-
module Cloud
|
20
|
-
module Vision
|
21
|
-
module V1p3beta1
|
22
|
-
class Credentials < Google::Auth::Credentials
|
23
|
-
SCOPE = [
|
24
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
25
|
-
"https://www.googleapis.com/auth/cloud-vision"
|
26
|
-
].freeze
|
27
|
-
PATH_ENV_VARS = %w(VISION_CREDENTIALS
|
28
|
-
VISION_KEYFILE
|
29
|
-
GOOGLE_CLOUD_CREDENTIALS
|
30
|
-
GOOGLE_CLOUD_KEYFILE
|
31
|
-
GCLOUD_KEYFILE)
|
32
|
-
JSON_ENV_VARS = %w(VISION_CREDENTIALS_JSON
|
33
|
-
VISION_KEYFILE_JSON
|
34
|
-
GOOGLE_CLOUD_CREDENTIALS_JSON
|
35
|
-
GOOGLE_CLOUD_KEYFILE_JSON
|
36
|
-
GCLOUD_KEYFILE_JSON)
|
37
|
-
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
module Google
|
17
|
-
module Cloud
|
18
|
-
module Vision
|
19
|
-
module V1p3beta1
|
20
|
-
# A vertex represents a 2D point in the image.
|
21
|
-
# NOTE: the vertex coordinates are in the same scale as the original image.
|
22
|
-
# @!attribute [rw] x
|
23
|
-
# @return [Integer]
|
24
|
-
# X coordinate.
|
25
|
-
# @!attribute [rw] y
|
26
|
-
# @return [Integer]
|
27
|
-
# Y coordinate.
|
28
|
-
class Vertex; end
|
29
|
-
|
30
|
-
# A vertex represents a 2D point in the image.
|
31
|
-
# NOTE: the normalized vertex coordinates are relative to the original image
|
32
|
-
# and range from 0 to 1.
|
33
|
-
# @!attribute [rw] x
|
34
|
-
# @return [Float]
|
35
|
-
# X coordinate.
|
36
|
-
# @!attribute [rw] y
|
37
|
-
# @return [Float]
|
38
|
-
# Y coordinate.
|
39
|
-
class NormalizedVertex; end
|
40
|
-
|
41
|
-
# A bounding polygon for the detected image annotation.
|
42
|
-
# @!attribute [rw] vertices
|
43
|
-
# @return [Array<Google::Cloud::Vision::V1p3beta1::Vertex>]
|
44
|
-
# The bounding polygon vertices.
|
45
|
-
# @!attribute [rw] normalized_vertices
|
46
|
-
# @return [Array<Google::Cloud::Vision::V1p3beta1::NormalizedVertex>]
|
47
|
-
# The bounding polygon normalized vertices.
|
48
|
-
class BoundingPoly; end
|
49
|
-
|
50
|
-
# A normalized bounding polygon around a portion of an image.
|
51
|
-
# @!attribute [rw] vertices
|
52
|
-
# @return [Array<Google::Cloud::Vision::V1p3beta1::NormalizedVertex>]
|
53
|
-
# Normalized vertices of the bounding polygon.
|
54
|
-
class NormalizedBoundingPoly; end
|
55
|
-
|
56
|
-
# A 3D position in the image, used primarily for Face detection landmarks.
|
57
|
-
# A valid Position must have both x and y coordinates.
|
58
|
-
# The position coordinates are in the same scale as the original image.
|
59
|
-
# @!attribute [rw] x
|
60
|
-
# @return [Float]
|
61
|
-
# X coordinate.
|
62
|
-
# @!attribute [rw] y
|
63
|
-
# @return [Float]
|
64
|
-
# Y coordinate.
|
65
|
-
# @!attribute [rw] z
|
66
|
-
# @return [Float]
|
67
|
-
# Z coordinate (or depth).
|
68
|
-
class Position; end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|