azure_cognitiveservices_customvisionprediction 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction.rb +31 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb +593 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/bounding_box.rb +80 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_prediction.rb +105 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_url.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/prediction.rb +85 -0
- data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/module_definition.rb +9 -0
- data/lib/azure_cognitiveservices_customvisionprediction.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/customvisionprediction_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/customvisionprediction_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/customvisionprediction_profile_module.rb +73 -0
- data/lib/version.rb +7 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31d4c08ea63a0d41f802394030d46544b2579562
|
4
|
+
data.tar.gz: 9a3123e45418dad57728ba67944a973691094cab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff72db9a9259534ffc2ce526cb69ad968fb8e6d9ff3f5e82fd57b24acf638d14a92d27efe3348786a17825b612cdb65152bbaa7f9855246301f05a03e4ee980e
|
7
|
+
data.tar.gz: a2501a5d364af8e2d8b8f010fff96353d7edf4d8fe09eb8fa725a458e4c23991f2bb386f28b6aa4a220e710ebe2a00bf519737107d4bfd46085d9143dd22d3dd
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
require 'uri'
|
7
|
+
require 'cgi'
|
8
|
+
require 'date'
|
9
|
+
require 'json'
|
10
|
+
require 'base64'
|
11
|
+
require 'erb'
|
12
|
+
require 'securerandom'
|
13
|
+
require 'time'
|
14
|
+
require 'timeliness'
|
15
|
+
require 'faraday'
|
16
|
+
require 'faraday-cookie_jar'
|
17
|
+
require 'concurrent'
|
18
|
+
require 'ms_rest'
|
19
|
+
require '2.0/generated/azure_cognitiveservices_customvisionprediction/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0
|
23
|
+
autoload :CustomvisionpredictionClient, '2.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb'
|
24
|
+
|
25
|
+
module Models
|
26
|
+
autoload :Prediction, '2.0/generated/azure_cognitiveservices_customvisionprediction/models/prediction.rb'
|
27
|
+
autoload :ImageUrl, '2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_url.rb'
|
28
|
+
autoload :ImagePrediction, '2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_prediction.rb'
|
29
|
+
autoload :BoundingBox, '2.0/generated/azure_cognitiveservices_customvisionprediction/models/bounding_box.rb'
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,593 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class CustomvisionpredictionClient < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_reader :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :api_key
|
22
|
+
|
23
|
+
# @return [String] Supported Cognitive Services endpoints
|
24
|
+
attr_accessor :endpoint
|
25
|
+
|
26
|
+
# @return [String] The preferred language for the response.
|
27
|
+
attr_accessor :accept_language
|
28
|
+
|
29
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
30
|
+
# Operations. Default value is 30.
|
31
|
+
attr_accessor :long_running_operation_retry_timeout
|
32
|
+
|
33
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
34
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
35
|
+
# generated and included in each request. Default is true.
|
36
|
+
attr_accessor :generate_client_request_id
|
37
|
+
|
38
|
+
#
|
39
|
+
# Creates initializes a new instance of the CustomvisionpredictionClient class.
|
40
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
41
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
42
|
+
#
|
43
|
+
def initialize(credentials = nil, options = nil)
|
44
|
+
super(credentials, options)
|
45
|
+
@base_url = '{Endpoint}/customvision/v2.0/Prediction'
|
46
|
+
|
47
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
48
|
+
@credentials = credentials
|
49
|
+
|
50
|
+
@accept_language = 'en-US'
|
51
|
+
@long_running_operation_retry_timeout = 30
|
52
|
+
@generate_client_request_id = true
|
53
|
+
add_telemetry
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Makes a request and returns the body of the response.
|
58
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
59
|
+
# @param path [String] the path, relative to {base_url}.
|
60
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
61
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
62
|
+
# Example:
|
63
|
+
#
|
64
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
65
|
+
# path = "/path"
|
66
|
+
# options = {
|
67
|
+
# body: request_content,
|
68
|
+
# query_params: {'api-version' => '2016-02-01'}
|
69
|
+
# }
|
70
|
+
# result = @client.make_request(:put, path, options)
|
71
|
+
#
|
72
|
+
def make_request(method, path, options = {})
|
73
|
+
result = make_request_with_http_info(method, path, options)
|
74
|
+
result.body unless result.nil?
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# Makes a request and returns the operation response.
|
79
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
80
|
+
# @param path [String] the path, relative to {base_url}.
|
81
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
82
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
83
|
+
#
|
84
|
+
def make_request_with_http_info(method, path, options = {})
|
85
|
+
result = make_request_async(method, path, options).value!
|
86
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
87
|
+
result
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Makes a request asynchronously.
|
92
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
93
|
+
# @param path [String] the path, relative to {base_url}.
|
94
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
95
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
96
|
+
#
|
97
|
+
def make_request_async(method, path, options = {})
|
98
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
99
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
100
|
+
|
101
|
+
request_url = options[:base_url] || @base_url
|
102
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
103
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
104
|
+
end
|
105
|
+
|
106
|
+
request_headers = @request_headers
|
107
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
108
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
109
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
110
|
+
|
111
|
+
super(request_url, method, path, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# Predict an image url and saves the result
|
116
|
+
#
|
117
|
+
# @param project_id The project id
|
118
|
+
# @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
|
119
|
+
# the url of the image to be evaluated
|
120
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
121
|
+
# evaluate against.
|
122
|
+
# The default iteration for the project will be used when not specified
|
123
|
+
# @param application [String] Optional. Specifies the name of application using
|
124
|
+
# the endpoint
|
125
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
126
|
+
# will be added to the HTTP request.
|
127
|
+
#
|
128
|
+
# @return [ImagePrediction] operation results.
|
129
|
+
#
|
130
|
+
def predict_image_url(project_id, image_url, iteration_id:nil, application:nil, custom_headers:nil)
|
131
|
+
response = predict_image_url_async(project_id, image_url, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
132
|
+
response.body unless response.nil?
|
133
|
+
end
|
134
|
+
|
135
|
+
#
|
136
|
+
# Predict an image url and saves the result
|
137
|
+
#
|
138
|
+
# @param project_id The project id
|
139
|
+
# @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
|
140
|
+
# the url of the image to be evaluated
|
141
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
142
|
+
# evaluate against.
|
143
|
+
# The default iteration for the project will be used when not specified
|
144
|
+
# @param application [String] Optional. Specifies the name of application using
|
145
|
+
# the endpoint
|
146
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
147
|
+
# will be added to the HTTP request.
|
148
|
+
#
|
149
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
150
|
+
#
|
151
|
+
def predict_image_url_with_http_info(project_id, image_url, iteration_id:nil, application:nil, custom_headers:nil)
|
152
|
+
predict_image_url_async(project_id, image_url, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# Predict an image url and saves the result
|
157
|
+
#
|
158
|
+
# @param project_id The project id
|
159
|
+
# @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
|
160
|
+
# the url of the image to be evaluated
|
161
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
162
|
+
# evaluate against.
|
163
|
+
# The default iteration for the project will be used when not specified
|
164
|
+
# @param application [String] Optional. Specifies the name of application using
|
165
|
+
# the endpoint
|
166
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
167
|
+
# to the HTTP request.
|
168
|
+
#
|
169
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
170
|
+
#
|
171
|
+
def predict_image_url_async(project_id, image_url, iteration_id:nil, application:nil, custom_headers:nil)
|
172
|
+
fail ArgumentError, 'endpoint is nil' if endpoint.nil?
|
173
|
+
fail ArgumentError, 'project_id is nil' if project_id.nil?
|
174
|
+
fail ArgumentError, 'image_url is nil' if image_url.nil?
|
175
|
+
fail ArgumentError, 'api_key is nil' if api_key.nil?
|
176
|
+
|
177
|
+
|
178
|
+
request_headers = {}
|
179
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
180
|
+
|
181
|
+
# Set Headers
|
182
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
183
|
+
request_headers['Prediction-Key'] = api_key unless api_key.nil?
|
184
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
185
|
+
|
186
|
+
# Serialize Request
|
187
|
+
request_mapper = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImageUrl.mapper()
|
188
|
+
request_content = self.serialize(request_mapper, image_url)
|
189
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
190
|
+
|
191
|
+
path_template = '{projectId}/url'
|
192
|
+
|
193
|
+
request_url = @base_url || self.base_url
|
194
|
+
request_url = request_url.gsub('{Endpoint}', endpoint)
|
195
|
+
|
196
|
+
options = {
|
197
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
198
|
+
path_params: {'projectId' => project_id},
|
199
|
+
query_params: {'iterationId' => iteration_id,'application' => application},
|
200
|
+
body: request_content,
|
201
|
+
headers: request_headers.merge(custom_headers || {}),
|
202
|
+
base_url: request_url
|
203
|
+
}
|
204
|
+
promise = self.make_request_async(:post, path_template, options)
|
205
|
+
|
206
|
+
promise = promise.then do |result|
|
207
|
+
http_response = result.response
|
208
|
+
status_code = http_response.status
|
209
|
+
response_content = http_response.body
|
210
|
+
unless status_code == 200
|
211
|
+
error_model = JSON.load(response_content)
|
212
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
213
|
+
end
|
214
|
+
|
215
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
216
|
+
# Deserialize Response
|
217
|
+
if status_code == 200
|
218
|
+
begin
|
219
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
220
|
+
result_mapper = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImagePrediction.mapper()
|
221
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
222
|
+
rescue Exception => e
|
223
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
result
|
228
|
+
end
|
229
|
+
|
230
|
+
promise.execute
|
231
|
+
end
|
232
|
+
|
233
|
+
#
|
234
|
+
# Predict an image and saves the result
|
235
|
+
#
|
236
|
+
# @param project_id The project id
|
237
|
+
# @param image_data
|
238
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
239
|
+
# evaluate against.
|
240
|
+
# The default iteration for the project will be used when not specified
|
241
|
+
# @param application [String] Optional. Specifies the name of application using
|
242
|
+
# the endpoint
|
243
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
244
|
+
# will be added to the HTTP request.
|
245
|
+
#
|
246
|
+
# @return [ImagePrediction] operation results.
|
247
|
+
#
|
248
|
+
def predict_image(project_id, image_data, iteration_id:nil, application:nil, custom_headers:nil)
|
249
|
+
response = predict_image_async(project_id, image_data, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
250
|
+
response.body unless response.nil?
|
251
|
+
end
|
252
|
+
|
253
|
+
#
|
254
|
+
# Predict an image and saves the result
|
255
|
+
#
|
256
|
+
# @param project_id The project id
|
257
|
+
# @param image_data
|
258
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
259
|
+
# evaluate against.
|
260
|
+
# The default iteration for the project will be used when not specified
|
261
|
+
# @param application [String] Optional. Specifies the name of application using
|
262
|
+
# the endpoint
|
263
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
264
|
+
# will be added to the HTTP request.
|
265
|
+
#
|
266
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
267
|
+
#
|
268
|
+
def predict_image_with_http_info(project_id, image_data, iteration_id:nil, application:nil, custom_headers:nil)
|
269
|
+
predict_image_async(project_id, image_data, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
270
|
+
end
|
271
|
+
|
272
|
+
#
|
273
|
+
# Predict an image and saves the result
|
274
|
+
#
|
275
|
+
# @param project_id The project id
|
276
|
+
# @param image_data
|
277
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
278
|
+
# evaluate against.
|
279
|
+
# The default iteration for the project will be used when not specified
|
280
|
+
# @param application [String] Optional. Specifies the name of application using
|
281
|
+
# the endpoint
|
282
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
283
|
+
# to the HTTP request.
|
284
|
+
#
|
285
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
286
|
+
#
|
287
|
+
def predict_image_async(project_id, image_data, iteration_id:nil, application:nil, custom_headers:nil)
|
288
|
+
fail ArgumentError, 'endpoint is nil' if endpoint.nil?
|
289
|
+
fail ArgumentError, 'project_id is nil' if project_id.nil?
|
290
|
+
fail ArgumentError, 'image_data is nil' if image_data.nil?
|
291
|
+
fail ArgumentError, 'api_key is nil' if api_key.nil?
|
292
|
+
|
293
|
+
|
294
|
+
request_headers = {}
|
295
|
+
request_headers['Content-Type'] = 'multipart/form-data'
|
296
|
+
|
297
|
+
# Set Headers
|
298
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
299
|
+
request_headers['Prediction-Key'] = api_key unless api_key.nil?
|
300
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
301
|
+
|
302
|
+
# Set Form Data
|
303
|
+
form_data = {}
|
304
|
+
form_data['imageData'] = image_data.to_s unless image_data.to_s.nil?
|
305
|
+
|
306
|
+
path_template = '{projectId}/image'
|
307
|
+
|
308
|
+
request_url = @base_url || self.base_url
|
309
|
+
request_url = request_url.gsub('{Endpoint}', endpoint)
|
310
|
+
|
311
|
+
options = {
|
312
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
313
|
+
path_params: {'projectId' => project_id},
|
314
|
+
query_params: {'iterationId' => iteration_id,'application' => application},
|
315
|
+
headers: request_headers.merge(custom_headers || {}),
|
316
|
+
body: URI.encode_www_form(form_data),
|
317
|
+
base_url: request_url
|
318
|
+
}
|
319
|
+
promise = self.make_request_async(:post, path_template, options)
|
320
|
+
|
321
|
+
promise = promise.then do |result|
|
322
|
+
http_response = result.response
|
323
|
+
status_code = http_response.status
|
324
|
+
response_content = http_response.body
|
325
|
+
unless status_code == 200
|
326
|
+
error_model = JSON.load(response_content)
|
327
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
328
|
+
end
|
329
|
+
|
330
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
331
|
+
# Deserialize Response
|
332
|
+
if status_code == 200
|
333
|
+
begin
|
334
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
335
|
+
result_mapper = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImagePrediction.mapper()
|
336
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
337
|
+
rescue Exception => e
|
338
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
result
|
343
|
+
end
|
344
|
+
|
345
|
+
promise.execute
|
346
|
+
end
|
347
|
+
|
348
|
+
#
|
349
|
+
# Predict an image url without saving the result
|
350
|
+
#
|
351
|
+
# @param project_id The project id
|
352
|
+
# @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
|
353
|
+
# the url of the image to be evaluated
|
354
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
355
|
+
# evaluate against.
|
356
|
+
# The default iteration for the project will be used when not specified
|
357
|
+
# @param application [String] Optional. Specifies the name of application using
|
358
|
+
# the endpoint
|
359
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
360
|
+
# will be added to the HTTP request.
|
361
|
+
#
|
362
|
+
# @return [ImagePrediction] operation results.
|
363
|
+
#
|
364
|
+
def predict_image_url_with_no_store(project_id, image_url, iteration_id:nil, application:nil, custom_headers:nil)
|
365
|
+
response = predict_image_url_with_no_store_async(project_id, image_url, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
366
|
+
response.body unless response.nil?
|
367
|
+
end
|
368
|
+
|
369
|
+
#
|
370
|
+
# Predict an image url without saving the result
|
371
|
+
#
|
372
|
+
# @param project_id The project id
|
373
|
+
# @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
|
374
|
+
# the url of the image to be evaluated
|
375
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
376
|
+
# evaluate against.
|
377
|
+
# The default iteration for the project will be used when not specified
|
378
|
+
# @param application [String] Optional. Specifies the name of application using
|
379
|
+
# the endpoint
|
380
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
381
|
+
# will be added to the HTTP request.
|
382
|
+
#
|
383
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
384
|
+
#
|
385
|
+
def predict_image_url_with_no_store_with_http_info(project_id, image_url, iteration_id:nil, application:nil, custom_headers:nil)
|
386
|
+
predict_image_url_with_no_store_async(project_id, image_url, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
387
|
+
end
|
388
|
+
|
389
|
+
#
|
390
|
+
# Predict an image url without saving the result
|
391
|
+
#
|
392
|
+
# @param project_id The project id
|
393
|
+
# @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
|
394
|
+
# the url of the image to be evaluated
|
395
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
396
|
+
# evaluate against.
|
397
|
+
# The default iteration for the project will be used when not specified
|
398
|
+
# @param application [String] Optional. Specifies the name of application using
|
399
|
+
# the endpoint
|
400
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
401
|
+
# to the HTTP request.
|
402
|
+
#
|
403
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
404
|
+
#
|
405
|
+
def predict_image_url_with_no_store_async(project_id, image_url, iteration_id:nil, application:nil, custom_headers:nil)
|
406
|
+
fail ArgumentError, 'endpoint is nil' if endpoint.nil?
|
407
|
+
fail ArgumentError, 'project_id is nil' if project_id.nil?
|
408
|
+
fail ArgumentError, 'image_url is nil' if image_url.nil?
|
409
|
+
fail ArgumentError, 'api_key is nil' if api_key.nil?
|
410
|
+
|
411
|
+
|
412
|
+
request_headers = {}
|
413
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
414
|
+
|
415
|
+
# Set Headers
|
416
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
417
|
+
request_headers['Prediction-Key'] = api_key unless api_key.nil?
|
418
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
419
|
+
|
420
|
+
# Serialize Request
|
421
|
+
request_mapper = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImageUrl.mapper()
|
422
|
+
request_content = self.serialize(request_mapper, image_url)
|
423
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
424
|
+
|
425
|
+
path_template = '{projectId}/url/nostore'
|
426
|
+
|
427
|
+
request_url = @base_url || self.base_url
|
428
|
+
request_url = request_url.gsub('{Endpoint}', endpoint)
|
429
|
+
|
430
|
+
options = {
|
431
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
432
|
+
path_params: {'projectId' => project_id},
|
433
|
+
query_params: {'iterationId' => iteration_id,'application' => application},
|
434
|
+
body: request_content,
|
435
|
+
headers: request_headers.merge(custom_headers || {}),
|
436
|
+
base_url: request_url
|
437
|
+
}
|
438
|
+
promise = self.make_request_async(:post, path_template, options)
|
439
|
+
|
440
|
+
promise = promise.then do |result|
|
441
|
+
http_response = result.response
|
442
|
+
status_code = http_response.status
|
443
|
+
response_content = http_response.body
|
444
|
+
unless status_code == 200
|
445
|
+
error_model = JSON.load(response_content)
|
446
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
447
|
+
end
|
448
|
+
|
449
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
450
|
+
# Deserialize Response
|
451
|
+
if status_code == 200
|
452
|
+
begin
|
453
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
454
|
+
result_mapper = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImagePrediction.mapper()
|
455
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
456
|
+
rescue Exception => e
|
457
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
result
|
462
|
+
end
|
463
|
+
|
464
|
+
promise.execute
|
465
|
+
end
|
466
|
+
|
467
|
+
#
|
468
|
+
# Predict an image without saving the result
|
469
|
+
#
|
470
|
+
# @param project_id The project id
|
471
|
+
# @param image_data
|
472
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
473
|
+
# evaluate against.
|
474
|
+
# The default iteration for the project will be used when not specified
|
475
|
+
# @param application [String] Optional. Specifies the name of application using
|
476
|
+
# the endpoint
|
477
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
478
|
+
# will be added to the HTTP request.
|
479
|
+
#
|
480
|
+
# @return [ImagePrediction] operation results.
|
481
|
+
#
|
482
|
+
def predict_image_with_no_store(project_id, image_data, iteration_id:nil, application:nil, custom_headers:nil)
|
483
|
+
response = predict_image_with_no_store_async(project_id, image_data, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
484
|
+
response.body unless response.nil?
|
485
|
+
end
|
486
|
+
|
487
|
+
#
|
488
|
+
# Predict an image without saving the result
|
489
|
+
#
|
490
|
+
# @param project_id The project id
|
491
|
+
# @param image_data
|
492
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
493
|
+
# evaluate against.
|
494
|
+
# The default iteration for the project will be used when not specified
|
495
|
+
# @param application [String] Optional. Specifies the name of application using
|
496
|
+
# the endpoint
|
497
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
498
|
+
# will be added to the HTTP request.
|
499
|
+
#
|
500
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
501
|
+
#
|
502
|
+
def predict_image_with_no_store_with_http_info(project_id, image_data, iteration_id:nil, application:nil, custom_headers:nil)
|
503
|
+
predict_image_with_no_store_async(project_id, image_data, iteration_id:iteration_id, application:application, custom_headers:custom_headers).value!
|
504
|
+
end
|
505
|
+
|
506
|
+
#
|
507
|
+
# Predict an image without saving the result
|
508
|
+
#
|
509
|
+
# @param project_id The project id
|
510
|
+
# @param image_data
|
511
|
+
# @param iteration_id Optional. Specifies the id of a particular iteration to
|
512
|
+
# evaluate against.
|
513
|
+
# The default iteration for the project will be used when not specified
|
514
|
+
# @param application [String] Optional. Specifies the name of application using
|
515
|
+
# the endpoint
|
516
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
517
|
+
# to the HTTP request.
|
518
|
+
#
|
519
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
520
|
+
#
|
521
|
+
def predict_image_with_no_store_async(project_id, image_data, iteration_id:nil, application:nil, custom_headers:nil)
|
522
|
+
fail ArgumentError, 'endpoint is nil' if endpoint.nil?
|
523
|
+
fail ArgumentError, 'project_id is nil' if project_id.nil?
|
524
|
+
fail ArgumentError, 'image_data is nil' if image_data.nil?
|
525
|
+
fail ArgumentError, 'api_key is nil' if api_key.nil?
|
526
|
+
|
527
|
+
|
528
|
+
request_headers = {}
|
529
|
+
request_headers['Content-Type'] = 'multipart/form-data'
|
530
|
+
|
531
|
+
# Set Headers
|
532
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
533
|
+
request_headers['Prediction-Key'] = api_key unless api_key.nil?
|
534
|
+
request_headers['accept-language'] = accept_language unless accept_language.nil?
|
535
|
+
|
536
|
+
# Set Form Data
|
537
|
+
form_data = {}
|
538
|
+
form_data['imageData'] = image_data.to_s unless image_data.to_s.nil?
|
539
|
+
|
540
|
+
path_template = '{projectId}/image/nostore'
|
541
|
+
|
542
|
+
request_url = @base_url || self.base_url
|
543
|
+
request_url = request_url.gsub('{Endpoint}', endpoint)
|
544
|
+
|
545
|
+
options = {
|
546
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
547
|
+
path_params: {'projectId' => project_id},
|
548
|
+
query_params: {'iterationId' => iteration_id,'application' => application},
|
549
|
+
headers: request_headers.merge(custom_headers || {}),
|
550
|
+
body: URI.encode_www_form(form_data),
|
551
|
+
base_url: request_url
|
552
|
+
}
|
553
|
+
promise = self.make_request_async(:post, path_template, options)
|
554
|
+
|
555
|
+
promise = promise.then do |result|
|
556
|
+
http_response = result.response
|
557
|
+
status_code = http_response.status
|
558
|
+
response_content = http_response.body
|
559
|
+
unless status_code == 200
|
560
|
+
error_model = JSON.load(response_content)
|
561
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
562
|
+
end
|
563
|
+
|
564
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
565
|
+
# Deserialize Response
|
566
|
+
if status_code == 200
|
567
|
+
begin
|
568
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
569
|
+
result_mapper = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImagePrediction.mapper()
|
570
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
571
|
+
rescue Exception => e
|
572
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
576
|
+
result
|
577
|
+
end
|
578
|
+
|
579
|
+
promise.execute
|
580
|
+
end
|
581
|
+
|
582
|
+
|
583
|
+
private
|
584
|
+
#
|
585
|
+
# Adds telemetry information.
|
586
|
+
#
|
587
|
+
def add_telemetry
|
588
|
+
sdk_information = 'azure_cognitiveservices_customvisionprediction'
|
589
|
+
sdk_information = "#{sdk_information}/0.17.0"
|
590
|
+
add_user_agent_information(sdk_information)
|
591
|
+
end
|
592
|
+
end
|
593
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class BoundingBox
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [Float]
|
17
|
+
attr_accessor :left
|
18
|
+
|
19
|
+
# @return [Float]
|
20
|
+
attr_accessor :top
|
21
|
+
|
22
|
+
# @return [Float]
|
23
|
+
attr_accessor :width
|
24
|
+
|
25
|
+
# @return [Float]
|
26
|
+
attr_accessor :height
|
27
|
+
|
28
|
+
|
29
|
+
#
|
30
|
+
# Mapper for BoundingBox class as Ruby Hash.
|
31
|
+
# This will be used for serialization/deserialization.
|
32
|
+
#
|
33
|
+
def self.mapper()
|
34
|
+
{
|
35
|
+
client_side_validation: true,
|
36
|
+
required: false,
|
37
|
+
serialized_name: 'BoundingBox',
|
38
|
+
type: {
|
39
|
+
name: 'Composite',
|
40
|
+
class_name: 'BoundingBox',
|
41
|
+
model_properties: {
|
42
|
+
left: {
|
43
|
+
client_side_validation: true,
|
44
|
+
required: false,
|
45
|
+
serialized_name: 'left',
|
46
|
+
type: {
|
47
|
+
name: 'Double'
|
48
|
+
}
|
49
|
+
},
|
50
|
+
top: {
|
51
|
+
client_side_validation: true,
|
52
|
+
required: false,
|
53
|
+
serialized_name: 'top',
|
54
|
+
type: {
|
55
|
+
name: 'Double'
|
56
|
+
}
|
57
|
+
},
|
58
|
+
width: {
|
59
|
+
client_side_validation: true,
|
60
|
+
required: false,
|
61
|
+
serialized_name: 'width',
|
62
|
+
type: {
|
63
|
+
name: 'Double'
|
64
|
+
}
|
65
|
+
},
|
66
|
+
height: {
|
67
|
+
client_side_validation: true,
|
68
|
+
required: false,
|
69
|
+
serialized_name: 'height',
|
70
|
+
type: {
|
71
|
+
name: 'Double'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_prediction.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class ImagePrediction
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# @return
|
20
|
+
attr_accessor :project
|
21
|
+
|
22
|
+
# @return
|
23
|
+
attr_accessor :iteration
|
24
|
+
|
25
|
+
# @return [DateTime]
|
26
|
+
attr_accessor :created
|
27
|
+
|
28
|
+
# @return [Array<Prediction>]
|
29
|
+
attr_accessor :predictions
|
30
|
+
|
31
|
+
|
32
|
+
#
|
33
|
+
# Mapper for ImagePrediction class as Ruby Hash.
|
34
|
+
# This will be used for serialization/deserialization.
|
35
|
+
#
|
36
|
+
def self.mapper()
|
37
|
+
{
|
38
|
+
client_side_validation: true,
|
39
|
+
required: false,
|
40
|
+
serialized_name: 'ImagePrediction',
|
41
|
+
type: {
|
42
|
+
name: 'Composite',
|
43
|
+
class_name: 'ImagePrediction',
|
44
|
+
model_properties: {
|
45
|
+
id: {
|
46
|
+
client_side_validation: true,
|
47
|
+
required: false,
|
48
|
+
read_only: true,
|
49
|
+
serialized_name: 'id',
|
50
|
+
type: {
|
51
|
+
name: 'String'
|
52
|
+
}
|
53
|
+
},
|
54
|
+
project: {
|
55
|
+
client_side_validation: true,
|
56
|
+
required: false,
|
57
|
+
read_only: true,
|
58
|
+
serialized_name: 'project',
|
59
|
+
type: {
|
60
|
+
name: 'String'
|
61
|
+
}
|
62
|
+
},
|
63
|
+
iteration: {
|
64
|
+
client_side_validation: true,
|
65
|
+
required: false,
|
66
|
+
read_only: true,
|
67
|
+
serialized_name: 'iteration',
|
68
|
+
type: {
|
69
|
+
name: 'String'
|
70
|
+
}
|
71
|
+
},
|
72
|
+
created: {
|
73
|
+
client_side_validation: true,
|
74
|
+
required: false,
|
75
|
+
read_only: true,
|
76
|
+
serialized_name: 'created',
|
77
|
+
type: {
|
78
|
+
name: 'DateTime'
|
79
|
+
}
|
80
|
+
},
|
81
|
+
predictions: {
|
82
|
+
client_side_validation: true,
|
83
|
+
required: false,
|
84
|
+
read_only: true,
|
85
|
+
serialized_name: 'predictions',
|
86
|
+
type: {
|
87
|
+
name: 'Sequence',
|
88
|
+
element: {
|
89
|
+
client_side_validation: true,
|
90
|
+
required: false,
|
91
|
+
serialized_name: 'PredictionElementType',
|
92
|
+
type: {
|
93
|
+
name: 'Composite',
|
94
|
+
class_name: 'Prediction'
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class ImageUrl
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :url
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# Mapper for ImageUrl class as Ruby Hash.
|
22
|
+
# This will be used for serialization/deserialization.
|
23
|
+
#
|
24
|
+
def self.mapper()
|
25
|
+
{
|
26
|
+
client_side_validation: true,
|
27
|
+
required: false,
|
28
|
+
serialized_name: 'ImageUrl',
|
29
|
+
type: {
|
30
|
+
name: 'Composite',
|
31
|
+
class_name: 'ImageUrl',
|
32
|
+
model_properties: {
|
33
|
+
url: {
|
34
|
+
client_side_validation: true,
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'url',
|
37
|
+
type: {
|
38
|
+
name: 'String'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class Prediction
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [Float]
|
17
|
+
attr_accessor :probability
|
18
|
+
|
19
|
+
# @return
|
20
|
+
attr_accessor :tag_id
|
21
|
+
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :tag_name
|
24
|
+
|
25
|
+
# @return [BoundingBox]
|
26
|
+
attr_accessor :bounding_box
|
27
|
+
|
28
|
+
|
29
|
+
#
|
30
|
+
# Mapper for Prediction class as Ruby Hash.
|
31
|
+
# This will be used for serialization/deserialization.
|
32
|
+
#
|
33
|
+
def self.mapper()
|
34
|
+
{
|
35
|
+
client_side_validation: true,
|
36
|
+
required: false,
|
37
|
+
serialized_name: 'Prediction',
|
38
|
+
type: {
|
39
|
+
name: 'Composite',
|
40
|
+
class_name: 'Prediction',
|
41
|
+
model_properties: {
|
42
|
+
probability: {
|
43
|
+
client_side_validation: true,
|
44
|
+
required: false,
|
45
|
+
read_only: true,
|
46
|
+
serialized_name: 'probability',
|
47
|
+
type: {
|
48
|
+
name: 'Double'
|
49
|
+
}
|
50
|
+
},
|
51
|
+
tag_id: {
|
52
|
+
client_side_validation: true,
|
53
|
+
required: false,
|
54
|
+
read_only: true,
|
55
|
+
serialized_name: 'tagId',
|
56
|
+
type: {
|
57
|
+
name: 'String'
|
58
|
+
}
|
59
|
+
},
|
60
|
+
tag_name: {
|
61
|
+
client_side_validation: true,
|
62
|
+
required: false,
|
63
|
+
read_only: true,
|
64
|
+
serialized_name: 'tagName',
|
65
|
+
type: {
|
66
|
+
name: 'String'
|
67
|
+
}
|
68
|
+
},
|
69
|
+
bounding_box: {
|
70
|
+
client_side_validation: true,
|
71
|
+
required: false,
|
72
|
+
read_only: true,
|
73
|
+
serialized_name: 'boundingBox',
|
74
|
+
type: {
|
75
|
+
name: 'Composite',
|
76
|
+
class_name: 'BoundingBox'
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure end
|
7
|
+
module Azure::CognitiveServices end
|
8
|
+
module Azure::CognitiveServices::Customvisionprediction end
|
9
|
+
module Azure::CognitiveServices::Customvisionprediction::V2_0 end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require '2.0/generated/azure_cognitiveservices_customvisionprediction'
|
6
|
+
require 'profiles/latest/customvisionprediction_latest_profile_client'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
module Azure end
|
6
|
+
module Azure::CognitiveServices end
|
7
|
+
module Azure::CognitiveServices::Customvisionprediction end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require 'profiles/latest/customvisionprediction_module_definition'
|
6
|
+
require 'profiles/latest/modules/customvisionprediction_profile_module'
|
7
|
+
|
8
|
+
module Azure::Customvisionprediction::Profiles::Latest
|
9
|
+
#
|
10
|
+
# Client class for the Latest profile SDK.
|
11
|
+
#
|
12
|
+
class Client < CustomvisionpredictionDataClass
|
13
|
+
include MsRestAzure::Common::Configurable
|
14
|
+
|
15
|
+
#
|
16
|
+
# Initializes a new instance of the Client class.
|
17
|
+
# @param options [Hash] hash of client options.
|
18
|
+
# options = {
|
19
|
+
# tenant_id: 'YOUR TENANT ID',
|
20
|
+
# client_id: 'YOUR CLIENT ID',
|
21
|
+
# client_secret: 'YOUR CLIENT SECRET',
|
22
|
+
# subscription_id: 'YOUR SUBSCRIPTION ID',
|
23
|
+
# credentials: credentials,
|
24
|
+
# active_directory_settings: active_directory_settings,
|
25
|
+
# base_url: 'YOUR BASE URL',
|
26
|
+
# options: options
|
27
|
+
# }
|
28
|
+
# 'credentials' are optional and if not passed in the hash, will be obtained
|
29
|
+
# from MsRest::TokenCredentials using MsRestAzure::ApplicationTokenProvider.
|
30
|
+
#
|
31
|
+
# Also, base_url, active_directory_settings & options are optional.
|
32
|
+
#
|
33
|
+
def initialize(options = {})
|
34
|
+
super(options)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
module Azure end
|
6
|
+
module Azure::Customvisionprediction end
|
7
|
+
module Azure::Customvisionprediction::Profiles end
|
8
|
+
module Azure::Customvisionprediction::Profiles::Latest end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require 'azure_cognitiveservices_customvisionprediction'
|
6
|
+
|
7
|
+
module Azure::Customvisionprediction::Profiles::Latest
|
8
|
+
|
9
|
+
module Models
|
10
|
+
Prediction = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::Prediction
|
11
|
+
ImageUrl = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImageUrl
|
12
|
+
ImagePrediction = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImagePrediction
|
13
|
+
BoundingBox = Azure::CognitiveServices::Customvisionprediction::V2_0::Models::BoundingBox
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# CustomvisionpredictionDataClass
|
18
|
+
#
|
19
|
+
class CustomvisionpredictionDataClass
|
20
|
+
attr_reader :configurable, :base_url, :options, :model_classes
|
21
|
+
|
22
|
+
def initialize(options = {})
|
23
|
+
if options.is_a?(Hash) && options.length == 0
|
24
|
+
@options = setup_default_options
|
25
|
+
else
|
26
|
+
@options = options
|
27
|
+
end
|
28
|
+
|
29
|
+
reset!(options)
|
30
|
+
|
31
|
+
@configurable = self
|
32
|
+
@base_url = options[:base_url].nil? ? nil:options[:base_url]
|
33
|
+
@options = options[:options].nil? ? nil:options[:options]
|
34
|
+
|
35
|
+
@client_0 = Azure::CognitiveServices::Customvisionprediction::V2_0::CustomvisionpredictionClient.new(configurable.credentials, options)
|
36
|
+
if(@client_0.respond_to?(:subscription_id))
|
37
|
+
@client_0.subscription_id = configurable.subscription_id
|
38
|
+
end
|
39
|
+
add_telemetry(@client_0)
|
40
|
+
|
41
|
+
@model_classes = ModelClasses.new
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_telemetry(client)
|
45
|
+
profile_information = 'Profiles/Latest/Customvisionprediction'
|
46
|
+
client.add_user_agent_information(profile_information)
|
47
|
+
end
|
48
|
+
|
49
|
+
def method_missing(method, *args)
|
50
|
+
if @client_0.respond_to?method
|
51
|
+
@client_0.send(method, *args)
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
class ModelClasses
|
60
|
+
def prediction
|
61
|
+
Azure::CognitiveServices::Customvisionprediction::V2_0::Models::Prediction
|
62
|
+
end
|
63
|
+
def image_url
|
64
|
+
Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImageUrl
|
65
|
+
end
|
66
|
+
def image_prediction
|
67
|
+
Azure::CognitiveServices::Customvisionprediction::V2_0::Models::ImagePrediction
|
68
|
+
end
|
69
|
+
def bounding_box
|
70
|
+
Azure::CognitiveServices::Customvisionprediction::V2_0::Models::BoundingBox
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: azure_cognitiveservices_customvisionprediction
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.17.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Microsoft Corporation
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ms_rest_azure
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.11.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.11.0
|
83
|
+
description: Microsoft Azure Cognitive Services Custom Vision Prediction Library for
|
84
|
+
Ruby
|
85
|
+
email: azrubyteam@microsoft.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE.txt
|
91
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction.rb
|
92
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb
|
93
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/bounding_box.rb
|
94
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_prediction.rb
|
95
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/image_url.rb
|
96
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction/models/prediction.rb
|
97
|
+
- lib/2.0/generated/azure_cognitiveservices_customvisionprediction/module_definition.rb
|
98
|
+
- lib/azure_cognitiveservices_customvisionprediction.rb
|
99
|
+
- lib/module_definition.rb
|
100
|
+
- lib/profiles/latest/customvisionprediction_latest_profile_client.rb
|
101
|
+
- lib/profiles/latest/customvisionprediction_module_definition.rb
|
102
|
+
- lib/profiles/latest/modules/customvisionprediction_profile_module.rb
|
103
|
+
- lib/version.rb
|
104
|
+
homepage: https://aka.ms/azure-sdk-for-ruby
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata:
|
108
|
+
bug_tracker_uri: https://github.com/Azure/azure-sdk-for-ruby/issues
|
109
|
+
changelog_uri: https://github.com/Azure/azure-sdk-for-ruby/blob/master/ChangeLog.md
|
110
|
+
documentation_uri: https://azure.microsoft.com/en-us/develop/ruby/
|
111
|
+
homepage_uri: https://aka.ms/azure-sdk-for-ruby
|
112
|
+
source_code_uri: https://github.com/Azure/azure-sdk-for-ruby/tree/master/data/azure_cognitiveservices_customvisionprediction
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 2.0.0
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.5.1
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Official Ruby client library to consume Microsoft Azure Cognitive Services
|
133
|
+
Custom Vision Prediction.
|
134
|
+
test_files: []
|