Class: Azure::CognitiveServices::ComputerVision::V2_0::ComputerVisionClient
- Inherits:
-
MsRestAzure::AzureServiceClient
- Object
- MsRestAzure::AzureServiceClient
- Azure::CognitiveServices::ComputerVision::V2_0::ComputerVisionClient
- Includes:
- MsRestAzure, MsRestAzure::Serialization
- Defined in:
- lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb
Overview
A service client - single point of access to the REST API.
Instance Attribute Summary collapse
-
#accept_language ⇒ String
The preferred language for the response.
-
#base_url ⇒ String
readonly
The base URI of the service.
-
#credentials ⇒ Object
subscription.
-
#credentials1 ⇒ Object
readonly
Credentials needed for the client to connect to Azure.
-
#endpoint ⇒ String
Supported Cognitive Services endpoints.
-
#generate_client_request_id ⇒ Boolean
generated.
-
#long_running_operation_retry_timeout ⇒ Integer
Operations.
Instance Method Summary collapse
-
#analyze_image(url, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ ImageAnalysis
This operation extracts a rich set of visual features based on the image content.
-
#analyze_image_async(url, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation extracts a rich set of visual features based on the image content.
-
#analyze_image_by_domain(model, url, language: nil, custom_headers: nil) ⇒ DomainModelResults
This operation recognizes content within an image by applying a domain-specific model.
-
#analyze_image_by_domain_async(model, url, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation recognizes content within an image by applying a domain-specific model.
-
#analyze_image_by_domain_in_stream(model, image, language: nil, custom_headers: nil) ⇒ DomainModelResults
This operation recognizes content within an image by applying a domain-specific model.
-
#analyze_image_by_domain_in_stream_async(model, image, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation recognizes content within an image by applying a domain-specific model.
-
#analyze_image_by_domain_in_stream_with_http_info(model, image, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation recognizes content within an image by applying a domain-specific model.
-
#analyze_image_by_domain_with_http_info(model, url, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation recognizes content within an image by applying a domain-specific model.
-
#analyze_image_in_stream(image, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ ImageAnalysis
This operation extracts a rich set of visual features based on the image content.
-
#analyze_image_in_stream_async(image, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation extracts a rich set of visual features based on the image content.
-
#analyze_image_in_stream_with_http_info(image, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation extracts a rich set of visual features based on the image content.
-
#analyze_image_with_http_info(url, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation extracts a rich set of visual features based on the image content.
-
#batch_read_file(url, custom_headers: nil) ⇒ Object
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents.
-
#batch_read_file_async(url, custom_headers: nil) ⇒ Concurrent::Promise
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents.
-
#batch_read_file_in_stream(image, custom_headers: nil) ⇒ Object
Use this interface to get the result of a Read Document operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents.
-
#batch_read_file_in_stream_async(image, custom_headers: nil) ⇒ Concurrent::Promise
Use this interface to get the result of a Read Document operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents.
-
#batch_read_file_in_stream_with_http_info(image, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Use this interface to get the result of a Read Document operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents.
-
#batch_read_file_with_http_info(url, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents.
-
#describe_image(url, max_candidates: 1, language: nil, custom_headers: nil) ⇒ ImageDescription
This operation generates a description of an image in human readable language with complete sentences.
-
#describe_image_async(url, max_candidates: 1, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a description of an image in human readable language with complete sentences.
-
#describe_image_in_stream(image, max_candidates: 1, language: nil, custom_headers: nil) ⇒ ImageDescription
This operation generates a description of an image in human readable language with complete sentences.
-
#describe_image_in_stream_async(image, max_candidates: 1, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a description of an image in human readable language with complete sentences.
-
#describe_image_in_stream_with_http_info(image, max_candidates: 1, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a description of an image in human readable language with complete sentences.
-
#describe_image_with_http_info(url, max_candidates: 1, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a description of an image in human readable language with complete sentences.
-
#detect_objects(url, custom_headers: nil) ⇒ DetectResult
Performs object detection on the specified image.
-
#detect_objects_async(url, custom_headers: nil) ⇒ Concurrent::Promise
Performs object detection on the specified image.
-
#detect_objects_in_stream(image, custom_headers: nil) ⇒ DetectResult
Performs object detection on the specified image.
-
#detect_objects_in_stream_async(image, custom_headers: nil) ⇒ Concurrent::Promise
Performs object detection on the specified image.
-
#detect_objects_in_stream_with_http_info(image, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Performs object detection on the specified image.
-
#detect_objects_with_http_info(url, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Performs object detection on the specified image.
-
#generate_thumbnail(width, height, url, smart_cropping: false, custom_headers: nil) ⇒ NOT_IMPLEMENTED
This operation generates a thumbnail image with the user-specified width and height.
-
#generate_thumbnail_async(width, height, url, smart_cropping: false, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a thumbnail image with the user-specified width and height.
-
#generate_thumbnail_in_stream(width, height, image, smart_cropping: false, custom_headers: nil) ⇒ NOT_IMPLEMENTED
This operation generates a thumbnail image with the user-specified width and height.
-
#generate_thumbnail_in_stream_async(width, height, image, smart_cropping: false, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a thumbnail image with the user-specified width and height.
-
#generate_thumbnail_in_stream_with_http_info(width, height, image, smart_cropping: false, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a thumbnail image with the user-specified width and height.
-
#generate_thumbnail_with_http_info(width, height, url, smart_cropping: false, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a thumbnail image with the user-specified width and height.
-
#get_area_of_interest(url, custom_headers: nil) ⇒ AreaOfInterestResult
This operation returns a bounding box around the most important area of the image.
-
#get_area_of_interest_async(url, custom_headers: nil) ⇒ Concurrent::Promise
This operation returns a bounding box around the most important area of the image.
-
#get_area_of_interest_in_stream(image, custom_headers: nil) ⇒ AreaOfInterestResult
This operation returns a bounding box around the most important area of the image.
-
#get_area_of_interest_in_stream_async(image, custom_headers: nil) ⇒ Concurrent::Promise
This operation returns a bounding box around the most important area of the image.
-
#get_area_of_interest_in_stream_with_http_info(image, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation returns a bounding box around the most important area of the image.
-
#get_area_of_interest_with_http_info(url, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation returns a bounding box around the most important area of the image.
-
#get_read_operation_result(operation_id, custom_headers: nil) ⇒ ReadOperationResult
This interface is used for getting OCR results of Read operation.
-
#get_read_operation_result_async(operation_id, custom_headers: nil) ⇒ Concurrent::Promise
This interface is used for getting OCR results of Read operation.
-
#get_read_operation_result_with_http_info(operation_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This interface is used for getting OCR results of Read operation.
-
#get_text_operation_result(operation_id, custom_headers: nil) ⇒ TextOperationResult
This interface is used for getting text operation result.
-
#get_text_operation_result_async(operation_id, custom_headers: nil) ⇒ Concurrent::Promise
This interface is used for getting text operation result.
-
#get_text_operation_result_with_http_info(operation_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This interface is used for getting text operation result.
-
#initialize(credentials = nil, options = nil) ⇒ ComputerVisionClient
constructor
Creates initializes a new instance of the ComputerVisionClient class.
-
#list_models(custom_headers: nil) ⇒ ListModelsResult
This operation returns the list of domain-specific models that are supported by the Computer Vision API.
-
#list_models_async(custom_headers: nil) ⇒ Concurrent::Promise
This operation returns the list of domain-specific models that are supported by the Computer Vision API.
-
#list_models_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation returns the list of domain-specific models that are supported by the Computer Vision API.
-
#make_request(method, path, options = {}) ⇒ Hash{String=>String}
Makes a request and returns the body of the response.
-
#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise
Makes a request asynchronously.
-
#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse
Makes a request and returns the operation response.
-
#recognize_printed_text(detect_orientation, url, language: nil, custom_headers: nil) ⇒ OcrResult
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
-
#recognize_printed_text_async(detect_orientation, url, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
-
#recognize_printed_text_in_stream(detect_orientation, image, language: nil, custom_headers: nil) ⇒ OcrResult
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
-
#recognize_printed_text_in_stream_async(detect_orientation, image, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
-
#recognize_printed_text_in_stream_with_http_info(detect_orientation, image, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
-
#recognize_printed_text_with_http_info(detect_orientation, url, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.
-
#recognize_text(url, mode, custom_headers: nil) ⇒ Object
Recognize Text operation.
-
#recognize_text_async(url, mode, custom_headers: nil) ⇒ Concurrent::Promise
Recognize Text operation.
-
#recognize_text_in_stream(image, mode, custom_headers: nil) ⇒ Object
Recognize Text operation.
-
#recognize_text_in_stream_async(image, mode, custom_headers: nil) ⇒ Concurrent::Promise
Recognize Text operation.
-
#recognize_text_in_stream_with_http_info(image, mode, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Recognize Text operation.
-
#recognize_text_with_http_info(url, mode, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Recognize Text operation.
-
#tag_image(url, language: nil, custom_headers: nil) ⇒ TagResult
This operation generates a list of words, or tags, that are relevant to the content of the supplied image.
-
#tag_image_async(url, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a list of words, or tags, that are relevant to the content of the supplied image.
-
#tag_image_in_stream(image, language: nil, custom_headers: nil) ⇒ TagResult
This operation generates a list of words, or tags, that are relevant to the content of the supplied image.
-
#tag_image_in_stream_async(image, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a list of words, or tags, that are relevant to the content of the supplied image.
-
#tag_image_in_stream_with_http_info(image, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a list of words, or tags, that are relevant to the content of the supplied image.
-
#tag_image_with_http_info(url, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a list of words, or tags, that are relevant to the content of the supplied image.
Constructor Details
#initialize(credentials = nil, options = nil) ⇒ ComputerVisionClient
Creates initializes a new instance of the ComputerVisionClient class.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 44 def initialize(credentials = nil, = nil) super(credentials, ) @base_url = '{Endpoint}/vision/v2.0' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @accept_language = 'en-US' @long_running_operation_retry_timeout = 30 @generate_client_request_id = true add_telemetry end |
Instance Attribute Details
#accept_language ⇒ String
Returns The preferred language for the response.
28 29 30 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 28 def accept_language @accept_language end |
#base_url ⇒ String (readonly)
Returns the base URI of the service.
15 16 17 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 15 def base_url @base_url end |
#credentials ⇒ Object
subscription.
25 26 27 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 25 def credentials @credentials end |
#credentials1 ⇒ Object (readonly)
Returns Credentials needed for the client to connect to Azure.
18 19 20 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 18 def credentials1 @credentials1 end |
#endpoint ⇒ String
Returns Supported Cognitive Services endpoints.
21 22 23 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 21 def endpoint @endpoint end |
#generate_client_request_id ⇒ Boolean
generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
37 38 39 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 37 def generate_client_request_id @generate_client_request_id end |
#long_running_operation_retry_timeout ⇒ Integer
Operations. Default value is 30.
32 33 34 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 32 def long_running_operation_retry_timeout @long_running_operation_retry_timeout end |
Instance Method Details
#analyze_image(url, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ ImageAnalysis
This operation extracts a rich set of visual features based on the image content. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the image content. Description - describes the image content with a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is black&white. Adult
-
detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. The Objects argument is only available in English. Brands - detects various brands within an image, including the approximate location. The Brands argument is only available in English. details to return. Multiple values should be comma-separated. Valid visual feature types include: Celebrities - identifies celebrities if detected in the image, Landmarks - identifies notable landmarks in the image. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
156 157 158 159 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 156 def analyze_image(url, visual_features:nil, details:nil, language:nil, custom_headers:nil) response = analyze_image_async(url, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#analyze_image_async(url, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation extracts a rich set of visual features based on the image content. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the image content. Description - describes the image content with a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is black&white. Adult
-
detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. The Objects argument is only available in English. Brands - detects various brands within an image, including the approximate location. The Brands argument is only available in English. details to return. Multiple values should be comma-separated. Valid visual feature types include: Celebrities - identifies celebrities if detected in the image, Landmarks - identifies notable landmarks in the image. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 247 def analyze_image_async(url, visual_features:nil, details:nil, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'analyze' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'visualFeatures' => visual_features.nil? ? nil : visual_features.join(','),'details' => details.nil? ? nil : details.join(','),'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageAnalysis.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#analyze_image_by_domain(model, url, language: nil, custom_headers: nil) ⇒ DomainModelResults
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API provides following domain-specific models: celebrities, landmarks. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
696 697 698 699 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 696 def analyze_image_by_domain(model, url, language:nil, custom_headers:nil) response = analyze_image_by_domain_async(model, url, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#analyze_image_by_domain_async(model, url, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API provides following domain-specific models: celebrities, landmarks. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 753 def analyze_image_by_domain_async(model, url, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'model is nil' if model.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'models/{model}/analyze' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'model' => model}, query_params: {'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::DomainModelResults.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#analyze_image_by_domain_in_stream(model, image, language: nil, custom_headers: nil) ⇒ DomainModelResults
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API provides following domain-specific models: celebrities, landmarks. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
2571 2572 2573 2574 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2571 def analyze_image_by_domain_in_stream(model, image, language:nil, custom_headers:nil) response = analyze_image_by_domain_in_stream_async(model, image, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#analyze_image_by_domain_in_stream_async(model, image, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API provides following domain-specific models: celebrities, landmarks. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2628 def analyze_image_by_domain_in_stream_async(model, image, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'model is nil' if model.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'models/{model}/analyze' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'model' => model}, query_params: {'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::DomainModelResults.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#analyze_image_by_domain_in_stream_with_http_info(model, image, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API provides following domain-specific models: celebrities, landmarks. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
2600 2601 2602 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2600 def analyze_image_by_domain_in_stream_with_http_info(model, image, language:nil, custom_headers:nil) analyze_image_by_domain_in_stream_async(model, image, language:language, custom_headers:custom_headers).value! end |
#analyze_image_by_domain_with_http_info(model, url, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API provides following domain-specific models: celebrities, landmarks. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
725 726 727 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 725 def analyze_image_by_domain_with_http_info(model, url, language:nil, custom_headers:nil) analyze_image_by_domain_async(model, url, language:language, custom_headers:custom_headers).value! end |
#analyze_image_in_stream(image, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ ImageAnalysis
This operation extracts a rich set of visual features based on the image content. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the image content. Description - describes the image content with a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is black&white. Adult
-
detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. The Objects argument is only available in English. Brands - detects various brands within an image, including the approximate location. The Brands argument is only available in English. details to return. Multiple values should be comma-separated. Valid visual feature types include: Celebrities - identifies celebrities if detected in the image, Landmarks - identifies notable landmarks in the image. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
1839 1840 1841 1842 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1839 def analyze_image_in_stream(image, visual_features:nil, details:nil, language:nil, custom_headers:nil) response = analyze_image_in_stream_async(image, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#analyze_image_in_stream_async(image, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation extracts a rich set of visual features based on the image content. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the image content. Description - describes the image content with a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is black&white. Adult
-
detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. The Objects argument is only available in English. Brands - detects various brands within an image, including the approximate location. The Brands argument is only available in English. details to return. Multiple values should be comma-separated. Valid visual feature types include: Celebrities - identifies celebrities if detected in the image, Landmarks - identifies notable landmarks in the image. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1930 def analyze_image_in_stream_async(image, visual_features:nil, details:nil, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'analyze' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'visualFeatures' => visual_features.nil? ? nil : visual_features.join(','),'details' => details.nil? ? nil : details.join(','),'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageAnalysis.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#analyze_image_in_stream_with_http_info(image, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation extracts a rich set of visual features based on the image content. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the image content. Description - describes the image content with a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is black&white. Adult
-
detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. The Objects argument is only available in English. Brands - detects various brands within an image, including the approximate location. The Brands argument is only available in English. details to return. Multiple values should be comma-separated. Valid visual feature types include: Celebrities - identifies celebrities if detected in the image, Landmarks - identifies notable landmarks in the image. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
1885 1886 1887 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1885 def analyze_image_in_stream_with_http_info(image, visual_features:nil, details:nil, language:nil, custom_headers:nil) analyze_image_in_stream_async(image, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value! end |
#analyze_image_with_http_info(url, visual_features: nil, details: nil, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation extracts a rich set of visual features based on the image content. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. Within your request, there is an optional parameter to allow you to choose which features to return. By default, image categories are returned in the response. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
visual feature types to return. Multiple values should be comma-separated. Valid visual feature types include: Categories - categorizes image content according to a taxonomy defined in documentation. Tags - tags the image with a detailed list of words related to the image content. Description - describes the image content with a complete English sentence. Faces - detects if faces are present. If present, generate coordinates, gender and age. ImageType - detects if image is clipart or a line drawing. Color - determines the accent color, dominant color, and whether an image is black&white. Adult
-
detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects various objects within an image, including the approximate location. The Objects argument is only available in English. Brands - detects various brands within an image, including the approximate location. The Brands argument is only available in English. details to return. Multiple values should be comma-separated. Valid visual feature types include: Celebrities - identifies celebrities if detected in the image, Landmarks - identifies notable landmarks in the image. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
202 203 204 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 202 def analyze_image_with_http_info(url, visual_features:nil, details:nil, language:nil, custom_headers:nil) analyze_image_async(url, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value! end |
#batch_read_file(url, custom_headers: nil) ⇒ Object
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read File interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your ‘GetReadOperationResult’ operation to access OCR results.
will be added to the HTTP request.
1610 1611 1612 1613 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1610 def batch_read_file(url, custom_headers:nil) response = batch_read_file_async(url, custom_headers:custom_headers).value! nil end |
#batch_read_file_async(url, custom_headers: nil) ⇒ Concurrent::Promise
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read File interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your ‘GetReadOperationResult’ operation to access OCR results.
to the HTTP request.
1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1647 def batch_read_file_async(url, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'read/core/asyncBatchAnalyze' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end |
#batch_read_file_in_stream(image, custom_headers: nil) ⇒ Object
Use this interface to get the result of a Read Document operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read Document interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your ‘Get Read Result operation’ to access OCR results.
will be added to the HTTP request.
3114 3115 3116 3117 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 3114 def batch_read_file_in_stream(image, custom_headers:nil) response = batch_read_file_in_stream_async(image, custom_headers:custom_headers).value! nil end |
#batch_read_file_in_stream_async(image, custom_headers: nil) ⇒ Concurrent::Promise
Use this interface to get the result of a Read Document operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read Document interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your ‘Get Read Result operation’ to access OCR results.
to the HTTP request.
3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 3151 def batch_read_file_in_stream_async(image, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'read/core/asyncBatchAnalyze' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end |
#batch_read_file_in_stream_with_http_info(image, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Use this interface to get the result of a Read Document operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read Document interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your ‘Get Read Result operation’ to access OCR results.
will be added to the HTTP request.
3133 3134 3135 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 3133 def batch_read_file_in_stream_with_http_info(image, custom_headers:nil) batch_read_file_in_stream_async(image, custom_headers:custom_headers).value! end |
#batch_read_file_with_http_info(url, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read File interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your ‘GetReadOperationResult’ operation to access OCR results.
will be added to the HTTP request.
1629 1630 1631 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1629 def batch_read_file_with_http_info(url, custom_headers:nil) batch_read_file_async(url, custom_headers:custom_headers).value! end |
#describe_image(url, max_candidates: 1, language: nil, custom_headers: nil) ⇒ ImageDescription
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
be returned. The default is 1. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
336 337 338 339 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 336 def describe_image(url, max_candidates:1, language:nil, custom_headers:nil) response = describe_image_async(url, max_candidates:max_candidates, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#describe_image_async(url, max_candidates: 1, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
be returned. The default is 1. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 395 def describe_image_async(url, max_candidates:1, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'describe' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxCandidates' => max_candidates,'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageDescription.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#describe_image_in_stream(image, max_candidates: 1, language: nil, custom_headers: nil) ⇒ ImageDescription
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
be returned. The default is 1. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
2143 2144 2145 2146 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2143 def describe_image_in_stream(image, max_candidates:1, language:nil, custom_headers:nil) response = describe_image_in_stream_async(image, max_candidates:max_candidates, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#describe_image_in_stream_async(image, max_candidates: 1, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
be returned. The default is 1. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2202 def describe_image_in_stream_async(image, max_candidates:1, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'describe' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'maxCandidates' => max_candidates,'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageDescription.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#describe_image_in_stream_with_http_info(image, max_candidates: 1, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
be returned. The default is 1. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
2173 2174 2175 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2173 def describe_image_in_stream_with_http_info(image, max_candidates:1, language:nil, custom_headers:nil) describe_image_in_stream_async(image, max_candidates:max_candidates, language:language, custom_headers:custom_headers).value! end |
#describe_image_with_http_info(url, max_candidates: 1, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
be returned. The default is 1. parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
366 367 368 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 366 def describe_image_with_http_info(url, max_candidates:1, language:nil, custom_headers:nil) describe_image_async(url, max_candidates:max_candidates, language:language, custom_headers:custom_headers).value! end |
#detect_objects(url, custom_headers: nil) ⇒ DetectResult
Performs object detection on the specified image. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
will be added to the HTTP request.
473 474 475 476 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 473 def detect_objects(url, custom_headers:nil) response = detect_objects_async(url, custom_headers:custom_headers).value! response.body unless response.nil? end |
#detect_objects_async(url, custom_headers: nil) ⇒ Concurrent::Promise
Performs object detection on the specified image. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
to the HTTP request.
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 510 def detect_objects_async(url, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'detect' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::DetectResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#detect_objects_in_stream(image, custom_headers: nil) ⇒ DetectResult
Performs object detection on the specified image. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
will be added to the HTTP request.
2282 2283 2284 2285 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2282 def detect_objects_in_stream(image, custom_headers:nil) response = detect_objects_in_stream_async(image, custom_headers:custom_headers).value! response.body unless response.nil? end |
#detect_objects_in_stream_async(image, custom_headers: nil) ⇒ Concurrent::Promise
Performs object detection on the specified image. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
to the HTTP request.
2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2319 def detect_objects_in_stream_async(image, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'detect' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::DetectResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#detect_objects_in_stream_with_http_info(image, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Performs object detection on the specified image. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
will be added to the HTTP request.
2301 2302 2303 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2301 def detect_objects_in_stream_with_http_info(image, custom_headers:nil) detect_objects_in_stream_async(image, custom_headers:custom_headers).value! end |
#detect_objects_with_http_info(url, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Performs object detection on the specified image. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
will be added to the HTTP request.
492 493 494 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 492 def detect_objects_with_http_info(url, custom_headers:nil) detect_objects_async(url, custom_headers:custom_headers).value! end |
#generate_thumbnail(width, height, url, smart_cropping: false, custom_headers: nil) ⇒ NOT_IMPLEMENTED
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
1 and 1024. Recommended minimum of 50. between 1 and 1024. Recommended minimum of 50. will be added to the HTTP request.
1138 1139 1140 1141 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1138 def generate_thumbnail(width, height, url, smart_cropping:false, custom_headers:nil) response = generate_thumbnail_async(width, height, url, smart_cropping:smart_cropping, custom_headers:custom_headers).value! response.body unless response.nil? end |
#generate_thumbnail_async(width, height, url, smart_cropping: false, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
1 and 1024. Recommended minimum of 50. between 1 and 1024. Recommended minimum of 50. to the HTTP request.
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1197 def generate_thumbnail_async(width, height, url, smart_cropping:false, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'width is nil' if width.nil? fail ArgumentError, "'width' should satisfy the constraint - 'InclusiveMaximum': '1024'" if !width.nil? && width > 1024 fail ArgumentError, "'width' should satisfy the constraint - 'InclusiveMinimum': '1'" if !width.nil? && width < 1 fail ArgumentError, 'height is nil' if height.nil? fail ArgumentError, "'height' should satisfy the constraint - 'InclusiveMaximum': '1024'" if !height.nil? && height > 1024 fail ArgumentError, "'height' should satisfy the constraint - 'InclusiveMinimum': '1'" if !height.nil? && height < 1 fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'generateThumbnail' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'width' => width,'height' => height,'smartCropping' => smart_cropping}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Stream' } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#generate_thumbnail_in_stream(width, height, image, smart_cropping: false, custom_headers: nil) ⇒ NOT_IMPLEMENTED
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
1 and 1024. Recommended minimum of 50. between 1 and 1024. Recommended minimum of 50. will be added to the HTTP request.
2409 2410 2411 2412 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2409 def generate_thumbnail_in_stream(width, height, image, smart_cropping:false, custom_headers:nil) response = generate_thumbnail_in_stream_async(width, height, image, smart_cropping:smart_cropping, custom_headers:custom_headers).value! response.body unless response.nil? end |
#generate_thumbnail_in_stream_async(width, height, image, smart_cropping: false, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
1 and 1024. Recommended minimum of 50. between 1 and 1024. Recommended minimum of 50. to the HTTP request.
2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2468 def generate_thumbnail_in_stream_async(width, height, image, smart_cropping:false, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'width is nil' if width.nil? fail ArgumentError, "'width' should satisfy the constraint - 'InclusiveMaximum': '1024'" if !width.nil? && width > 1024 fail ArgumentError, "'width' should satisfy the constraint - 'InclusiveMinimum': '1'" if !width.nil? && width < 1 fail ArgumentError, 'height is nil' if height.nil? fail ArgumentError, "'height' should satisfy the constraint - 'InclusiveMaximum': '1024'" if !height.nil? && height > 1024 fail ArgumentError, "'height' should satisfy the constraint - 'InclusiveMinimum': '1'" if !height.nil? && height < 1 fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'generateThumbnail' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'width' => width,'height' => height,'smartCropping' => smart_cropping}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Stream' } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#generate_thumbnail_in_stream_with_http_info(width, height, image, smart_cropping: false, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
1 and 1024. Recommended minimum of 50. between 1 and 1024. Recommended minimum of 50. will be added to the HTTP request.
2439 2440 2441 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2439 def generate_thumbnail_in_stream_with_http_info(width, height, image, smart_cropping:false, custom_headers:nil) generate_thumbnail_in_stream_async(width, height, image, smart_cropping:smart_cropping, custom_headers:custom_headers).value! end |
#generate_thumbnail_with_http_info(width, height, url, smart_cropping: false, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
1 and 1024. Recommended minimum of 50. between 1 and 1024. Recommended minimum of 50. will be added to the HTTP request.
1168 1169 1170 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1168 def generate_thumbnail_with_http_info(width, height, url, smart_cropping:false, custom_headers:nil) generate_thumbnail_async(width, height, url, smart_cropping:smart_cropping, custom_headers:custom_headers).value! end |
#get_area_of_interest(url, custom_headers: nil) ⇒ AreaOfInterestResult
This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
will be added to the HTTP request.
1290 1291 1292 1293 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1290 def get_area_of_interest(url, custom_headers:nil) response = get_area_of_interest_async(url, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_area_of_interest_async(url, custom_headers: nil) ⇒ Concurrent::Promise
This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
to the HTTP request.
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1331 def get_area_of_interest_async(url, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'areaOfInterest' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::AreaOfInterestResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_area_of_interest_in_stream(image, custom_headers: nil) ⇒ AreaOfInterestResult
This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
will be added to the HTTP request.
2012 2013 2014 2015 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2012 def get_area_of_interest_in_stream(image, custom_headers:nil) response = get_area_of_interest_in_stream_async(image, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_area_of_interest_in_stream_async(image, custom_headers: nil) ⇒ Concurrent::Promise
This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
to the HTTP request.
2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2053 def get_area_of_interest_in_stream_async(image, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'areaOfInterest' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::AreaOfInterestResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_area_of_interest_in_stream_with_http_info(image, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
will be added to the HTTP request.
2033 2034 2035 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2033 def get_area_of_interest_in_stream_with_http_info(image, custom_headers:nil) get_area_of_interest_in_stream_async(image, custom_headers:custom_headers).value! end |
#get_area_of_interest_with_http_info(url, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
will be added to the HTTP request.
1311 1312 1313 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1311 def get_area_of_interest_with_http_info(url, custom_headers:nil) get_area_of_interest_async(url, custom_headers:custom_headers).value! end |
#get_read_operation_result(operation_id, custom_headers: nil) ⇒ ReadOperationResult
This interface is used for getting OCR results of Read operation. The URL to this interface should be retrieved from ‘Operation-Location’ field returned from Batch Read File interface.
the ‘Batch Read File’ interface. will be added to the HTTP request.
1712 1713 1714 1715 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1712 def get_read_operation_result(operation_id, custom_headers:nil) response = get_read_operation_result_async(operation_id, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_read_operation_result_async(operation_id, custom_headers: nil) ⇒ Concurrent::Promise
This interface is used for getting OCR results of Read operation. The URL to this interface should be retrieved from ‘Operation-Location’ field returned from Batch Read File interface.
the ‘Batch Read File’ interface. to the HTTP request.
1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1745 def get_read_operation_result_async(operation_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'operation_id is nil' if operation_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'read/operations/{operationId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'operationId' => operation_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ReadOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_read_operation_result_with_http_info(operation_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This interface is used for getting OCR results of Read operation. The URL to this interface should be retrieved from ‘Operation-Location’ field returned from Batch Read File interface.
the ‘Batch Read File’ interface. will be added to the HTTP request.
1729 1730 1731 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1729 def get_read_operation_result_with_http_info(operation_id, custom_headers:nil) get_read_operation_result_async(operation_id, custom_headers:custom_headers).value! end |
#get_text_operation_result(operation_id, custom_headers: nil) ⇒ TextOperationResult
This interface is used for getting text operation result. The URL to this interface should be retrieved from ‘Operation-Location’ field returned from Recognize Text interface.
response of the ‘Recognize Text’ will be added to the HTTP request.
1511 1512 1513 1514 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1511 def get_text_operation_result(operation_id, custom_headers:nil) response = get_text_operation_result_async(operation_id, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_text_operation_result_async(operation_id, custom_headers: nil) ⇒ Concurrent::Promise
This interface is used for getting text operation result. The URL to this interface should be retrieved from ‘Operation-Location’ field returned from Recognize Text interface.
response of the ‘Recognize Text’ to the HTTP request.
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1544 def get_text_operation_result_async(operation_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'operation_id is nil' if operation_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'textOperations/{operationId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'operationId' => operation_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::TextOperationResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_text_operation_result_with_http_info(operation_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This interface is used for getting text operation result. The URL to this interface should be retrieved from ‘Operation-Location’ field returned from Recognize Text interface.
response of the ‘Recognize Text’ will be added to the HTTP request.
1528 1529 1530 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1528 def get_text_operation_result_with_http_info(operation_id, custom_headers:nil) get_text_operation_result_async(operation_id, custom_headers:custom_headers).value! end |
#list_models(custom_headers: nil) ⇒ ListModelsResult
This operation returns the list of domain-specific models that are supported by the Computer Vision API. Currently, the API supports following domain-specific models: celebrity recognizer, landmark recognizer. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
will be added to the HTTP request.
586 587 588 589 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 586 def list_models(custom_headers:nil) response = list_models_async(custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_models_async(custom_headers: nil) ⇒ Concurrent::Promise
This operation returns the list of domain-specific models that are supported by the Computer Vision API. Currently, the API supports following domain-specific models: celebrity recognizer, landmark recognizer. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
to the HTTP request.
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 621 def list_models_async(custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'models' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ListModelsResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_models_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation returns the list of domain-specific models that are supported by the Computer Vision API. Currently, the API supports following domain-specific models: celebrity recognizer, landmark recognizer. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
will be added to the HTTP request.
604 605 606 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 604 def list_models_with_http_info(custom_headers:nil) list_models_async(custom_headers:custom_headers).value! end |
#make_request(method, path, options = {}) ⇒ Hash{String=>String}
Makes a request and returns the body of the response. Example:
request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
path = "/path"
= {
body: request_content,
query_params: {'api-version' => '2016-02-01'}
}
result = @client.make_request(:put, path, )
73 74 75 76 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 73 def make_request(method, path, = {}) result = make_request_with_http_info(method, path, ) result.body unless result.nil? end |
#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise
Makes a request asynchronously.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 98 def make_request_async(method, path, = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = [:base_url] || @base_url if(![:headers].nil? && ![:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = [:headers]['Content-Type'] end request_headers = @request_headers request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? .merge!({headers: request_headers.merge([:headers] || {})}) .merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, ) end |
#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse
Makes a request and returns the operation response.
85 86 87 88 89 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 85 def make_request_with_http_info(method, path, = {}) result = make_request_async(method, path, ).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end |
#recognize_printed_text(detect_orientation, url, language: nil, custom_headers: nil) ⇒ OcrResult
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it’s upside-down). detected in the image. The default value is ‘unk’. Possible values include: ‘unk’, ‘zh-Hans’, ‘zh-Hant’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘fi’, ‘fr’, ‘de’, ‘el’, ‘hu’, ‘it’, ‘ja’, ‘ko’, ‘nb’, ‘pl’, ‘pt’, ‘ru’, ‘es’, ‘sv’, ‘tr’, ‘ar’, ‘ro’, ‘sr-Cyrl’, ‘sr-Latn’, ‘sk’ will be added to the HTTP request.
843 844 845 846 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 843 def recognize_printed_text(detect_orientation, url, language:nil, custom_headers:nil) response = recognize_printed_text_async(detect_orientation, url, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#recognize_printed_text_async(detect_orientation, url, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it’s upside-down). detected in the image. The default value is ‘unk’. Possible values include: ‘unk’, ‘zh-Hans’, ‘zh-Hant’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘fi’, ‘fr’, ‘de’, ‘el’, ‘hu’, ‘it’, ‘ja’, ‘ko’, ‘nb’, ‘pl’, ‘pt’, ‘ru’, ‘es’, ‘sv’, ‘tr’, ‘ar’, ‘ro’, ‘sr-Cyrl’, ‘sr-Latn’, ‘sk’ to the HTTP request.
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 900 def recognize_printed_text_async(detect_orientation, url, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'detect_orientation is nil' if detect_orientation.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'ocr' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'detectOrientation' => detect_orientation,'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::OcrResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#recognize_printed_text_in_stream(detect_orientation, image, language: nil, custom_headers: nil) ⇒ OcrResult
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it’s upside-down). detected in the image. The default value is ‘unk’. Possible values include: ‘unk’, ‘zh-Hans’, ‘zh-Hant’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘fi’, ‘fr’, ‘de’, ‘el’, ‘hu’, ‘it’, ‘ja’, ‘ko’, ‘nb’, ‘pl’, ‘pt’, ‘ru’, ‘es’, ‘sv’, ‘tr’, ‘ar’, ‘ro’, ‘sr-Cyrl’, ‘sr-Latn’, ‘sk’ will be added to the HTTP request.
2720 2721 2722 2723 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2720 def recognize_printed_text_in_stream(detect_orientation, image, language:nil, custom_headers:nil) response = recognize_printed_text_in_stream_async(detect_orientation, image, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#recognize_printed_text_in_stream_async(detect_orientation, image, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it’s upside-down). detected in the image. The default value is ‘unk’. Possible values include: ‘unk’, ‘zh-Hans’, ‘zh-Hant’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘fi’, ‘fr’, ‘de’, ‘el’, ‘hu’, ‘it’, ‘ja’, ‘ko’, ‘nb’, ‘pl’, ‘pt’, ‘ru’, ‘es’, ‘sv’, ‘tr’, ‘ar’, ‘ro’, ‘sr-Cyrl’, ‘sr-Latn’, ‘sk’ to the HTTP request.
2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2777 def recognize_printed_text_in_stream_async(detect_orientation, image, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'detect_orientation is nil' if detect_orientation.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'ocr' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'detectOrientation' => detect_orientation,'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::OcrResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#recognize_printed_text_in_stream_with_http_info(detect_orientation, image, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it’s upside-down). detected in the image. The default value is ‘unk’. Possible values include: ‘unk’, ‘zh-Hans’, ‘zh-Hant’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘fi’, ‘fr’, ‘de’, ‘el’, ‘hu’, ‘it’, ‘ja’, ‘ko’, ‘nb’, ‘pl’, ‘pt’, ‘ru’, ‘es’, ‘sv’, ‘tr’, ‘ar’, ‘ro’, ‘sr-Cyrl’, ‘sr-Latn’, ‘sk’ will be added to the HTTP request.
2749 2750 2751 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2749 def recognize_printed_text_in_stream_with_http_info(detect_orientation, image, language:nil, custom_headers:nil) recognize_printed_text_in_stream_async(detect_orientation, image, language:language, custom_headers:custom_headers).value! end |
#recognize_printed_text_with_http_info(detect_orientation, url, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it’s upside-down). detected in the image. The default value is ‘unk’. Possible values include: ‘unk’, ‘zh-Hans’, ‘zh-Hant’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘fi’, ‘fr’, ‘de’, ‘el’, ‘hu’, ‘it’, ‘ja’, ‘ko’, ‘nb’, ‘pl’, ‘pt’, ‘ru’, ‘es’, ‘sv’, ‘tr’, ‘ar’, ‘ro’, ‘sr-Cyrl’, ‘sr-Latn’, ‘sk’ will be added to the HTTP request.
872 873 874 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 872 def recognize_printed_text_with_http_info(detect_orientation, url, language:nil, custom_headers:nil) recognize_printed_text_async(detect_orientation, url, language:language, custom_headers:custom_headers).value! end |
#recognize_text(url, mode, custom_headers: nil) ⇒ Object
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your Get Recognize Text Operation Result operation.
include: ‘Handwritten’, ‘Printed’ will be added to the HTTP request.
1407 1408 1409 1410 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1407 def recognize_text(url, mode, custom_headers:nil) response = recognize_text_async(url, mode, custom_headers:custom_headers).value! nil end |
#recognize_text_async(url, mode, custom_headers: nil) ⇒ Concurrent::Promise
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your Get Recognize Text Operation Result operation.
include: ‘Handwritten’, ‘Printed’ to the HTTP request.
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1444 def recognize_text_async(url, mode, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'mode is nil' if mode.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'recognizeText' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'mode' => mode}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end |
#recognize_text_in_stream(image, mode, custom_headers: nil) ⇒ Object
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your Get Recognize Text Operation Result operation.
include: ‘Handwritten’, ‘Printed’ will be added to the HTTP request.
3007 3008 3009 3010 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 3007 def recognize_text_in_stream(image, mode, custom_headers:nil) response = recognize_text_in_stream_async(image, mode, custom_headers:custom_headers).value! nil end |
#recognize_text_in_stream_async(image, mode, custom_headers: nil) ⇒ Concurrent::Promise
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your Get Recognize Text Operation Result operation.
include: ‘Handwritten’, ‘Printed’ to the HTTP request.
3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 3044 def recognize_text_in_stream_async(image, mode, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? fail ArgumentError, 'mode is nil' if mode.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'recognizeText' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'mode' => mode}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end |
#recognize_text_in_stream_with_http_info(image, mode, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your Get Recognize Text Operation Result operation.
include: ‘Handwritten’, ‘Printed’ will be added to the HTTP request.
3026 3027 3028 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 3026 def recognize_text_in_stream_with_http_info(image, mode, custom_headers:nil) recognize_text_in_stream_async(image, mode, custom_headers:custom_headers).value! end |
#recognize_text_with_http_info(url, mode, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called ‘Operation-Location’. The ‘Operation-Location’ field contains the URL that you must use for your Get Recognize Text Operation Result operation.
include: ‘Handwritten’, ‘Printed’ will be added to the HTTP request.
1426 1427 1428 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1426 def recognize_text_with_http_info(url, mode, custom_headers:nil) recognize_text_async(url, mode, custom_headers:custom_headers).value! end |
#tag_image(url, language: nil, custom_headers: nil) ⇒ TagResult
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be accompanied by the hint “musical instrument”. All tags are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
990 991 992 993 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 990 def tag_image(url, language:nil, custom_headers:nil) response = tag_image_async(url, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#tag_image_async(url, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be accompanied by the hint “musical instrument”. All tags are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1049 def tag_image_async(url, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'url is nil' if url.nil? image_url = ImageUrl.new unless url.nil? image_url.url = url end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'tag' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::TagResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#tag_image_in_stream(image, language: nil, custom_headers: nil) ⇒ TagResult
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be accompanied by the hint “musical instrument”. All tags are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
2869 2870 2871 2872 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2869 def tag_image_in_stream(image, language:nil, custom_headers:nil) response = tag_image_in_stream_async(image, language:language, custom_headers:custom_headers).value! response.body unless response.nil? end |
#tag_image_in_stream_async(image, language: nil, custom_headers: nil) ⇒ Concurrent::Promise
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be accompanied by the hint “musical instrument”. All tags are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ to the HTTP request.
2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2928 def tag_image_in_stream_async(image, language:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'image is nil' if image.nil? request_headers = {} request_headers['Content-Type'] = 'application/octet-stream' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = { client_side_validation: true, required: true, serialized_name: 'Image', type: { name: 'Stream' } } request_content = self.serialize(request_mapper, image) path_template = 'tag' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'language' => language}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::TagResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#tag_image_in_stream_with_http_info(image, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be accompanied by the hint “musical instrument”. All tags are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
2899 2900 2901 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 2899 def tag_image_in_stream_with_http_info(image, language:nil, custom_headers:nil) tag_image_in_stream_async(image, language:language, custom_headers:custom_headers).value! end |
#tag_image_with_http_info(url, language: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be accompanied by the hint “musical instrument”. All tags are in English. Two input methods are supported – (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. Possible values include: ‘en’, ‘es’, ‘ja’, ‘pt’, ‘zh’ will be added to the HTTP request.
1020 1021 1022 |
# File 'lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb', line 1020 def tag_image_with_http_info(url, language:nil, custom_headers:nil) tag_image_async(url, language:language, custom_headers:custom_headers).value! end |