Class: MicrosoftComputerVision::Client
- Inherits:
-
Object
- Object
- MicrosoftComputerVision::Client
- Defined in:
- lib/microsoft_computer_vision/client.rb
Constant Summary collapse
- API_BASE =
'https://api.projectoxford.ai/vision/v1.0'
Instance Method Summary collapse
- #analyze_image_file(image_file, options) ⇒ Object
- #analyze_image_url(image_url, options) ⇒ Object
- #describe_image_file(image_file, options) ⇒ Object
- #describe_image_url(image_url, options) ⇒ Object
- #domain_model_image_file(image_file, options) ⇒ Object
- #domain_model_image_url(image_url, options) ⇒ Object
- #domain_models ⇒ Object
-
#initialize(subscription_key) ⇒ Client
constructor
A new instance of Client.
- #ocr_image_file(image_file, options) ⇒ Object
- #ocr_image_url(image_url, options) ⇒ Object
- #tag_image_file(image_file) ⇒ Object
- #tag_image_url(image_url) ⇒ Object
- #thumbnail_image_file(image_file, options) ⇒ Object
- #thumbnail_image_url(image_url, options) ⇒ Object
Constructor Details
#initialize(subscription_key) ⇒ Client
6 7 8 |
# File 'lib/microsoft_computer_vision/client.rb', line 6 def initialize(subscription_key) @subscription_key = subscription_key end |
Instance Method Details
#analyze_image_file(image_file, options) ⇒ Object
20 21 22 23 |
# File 'lib/microsoft_computer_vision/client.rb', line 20 def analyze_image_file(image_file, ) analyze = Api::Analyze.new([:visual_features], [:details]) post_image_file(analyze.uri, image_file) end |
#analyze_image_url(image_url, options) ⇒ Object
15 16 17 18 |
# File 'lib/microsoft_computer_vision/client.rb', line 15 def analyze_image_url(image_url, ) analyze = Api::Analyze.new([:visual_features], [:details]) post_image_url(analyze.uri, image_url) end |
#describe_image_file(image_file, options) ⇒ Object
35 36 37 38 |
# File 'lib/microsoft_computer_vision/client.rb', line 35 def describe_image_file(image_file, ) describe = Api::Describe.new([:max_candidates]) post_image_file(describe.uri, image_file) end |
#describe_image_url(image_url, options) ⇒ Object
30 31 32 33 |
# File 'lib/microsoft_computer_vision/client.rb', line 30 def describe_image_url(image_url, ) describe = Api::Describe.new([:max_candidates]) post_image_url(describe.uri, image_url) end |
#domain_model_image_file(image_file, options) ⇒ Object
75 76 77 78 |
# File 'lib/microsoft_computer_vision/client.rb', line 75 def domain_model_image_file(image_file, ) domain_model = Api::DomainModel.new([:model]) post_image_file(domain_model.uri, image_file) end |
#domain_model_image_url(image_url, options) ⇒ Object
70 71 72 73 |
# File 'lib/microsoft_computer_vision/client.rb', line 70 def domain_model_image_url(image_url, ) domain_model = Api::DomainModel.new([:model]) post_image_url(domain_model.uri, image_url) end |
#domain_models ⇒ Object
60 61 62 63 |
# File 'lib/microsoft_computer_vision/client.rb', line 60 def domain_models domain_models = Api::DomainModels.new() get(domain_models.uri, {}.to_json) end |
#ocr_image_file(image_file, options) ⇒ Object
90 91 92 93 |
# File 'lib/microsoft_computer_vision/client.rb', line 90 def ocr_image_file(image_file, ) ocr = Api::OCR.new([:language], [:detect_orientation]) post_image_file(ocr.uri, image_file) end |
#ocr_image_url(image_url, options) ⇒ Object
85 86 87 88 |
# File 'lib/microsoft_computer_vision/client.rb', line 85 def ocr_image_url(image_url, ) ocr = Api::OCR.new([:language], [:detect_orientation]) post_image_url(ocr.uri, image_url) end |
#tag_image_file(image_file) ⇒ Object
105 106 107 108 |
# File 'lib/microsoft_computer_vision/client.rb', line 105 def tag_image_file(image_file) tag = Api::Tag.new() post_image_file(tag.uri, image_file) end |
#tag_image_url(image_url) ⇒ Object
100 101 102 103 |
# File 'lib/microsoft_computer_vision/client.rb', line 100 def tag_image_url(image_url) tag = Api::Tag.new() post_image_url(tag.uri, image_url) end |
#thumbnail_image_file(image_file, options) ⇒ Object
50 51 52 53 |
# File 'lib/microsoft_computer_vision/client.rb', line 50 def thumbnail_image_file(image_file, ) thumbnail = Api::Thumbnail.new([:width], [:height], [:smart_cropping]) post_image_file(thumbnail.uri, image_file) end |
#thumbnail_image_url(image_url, options) ⇒ Object
45 46 47 48 |
# File 'lib/microsoft_computer_vision/client.rb', line 45 def thumbnail_image_url(image_url, ) thumbnail = Api::Thumbnail.new([:width], [:height], [:smart_cropping]) post_image_url(thumbnail.uri, image_url) end |