microsoft_computer_vision 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/microsoft_computer_vision/api/analyze.rb +2 -2
- data/lib/microsoft_computer_vision/api/describe.rb +2 -2
- data/lib/microsoft_computer_vision/api/domain_model.rb +2 -2
- data/lib/microsoft_computer_vision/api/domain_models.rb +2 -2
- data/lib/microsoft_computer_vision/api/ocr.rb +2 -2
- data/lib/microsoft_computer_vision/api/tag.rb +2 -2
- data/lib/microsoft_computer_vision/api/thumbnail.rb +2 -2
- data/lib/microsoft_computer_vision/client.rb +9 -11
- data/lib/microsoft_computer_vision/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f5c9be4fccfb7897067556f61c9f059857dcb63
|
4
|
+
data.tar.gz: 44eabddfb4f57e193be2838b07b348419da4d192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51d0bb5b552e1997f53ffe6e8d69a2457a1121fc3afd1acaaa8b6e193243bd75c63601a7a30c28e6354a22bcb47b7c57acb2fc9ef45bd94faaf7a09f70c621b0
|
7
|
+
data.tar.gz: 8213498f365128c7651c66f7ec16f143f3eab2ed5d15bca17ab81c30b8f6f99afac61945ee778d291001149f6bd8fdbcc9e142d596f1351311a190ab56c690dc
|
data/README.md
CHANGED
@@ -10,8 +10,8 @@ module MicrosoftComputerVision::Api
|
|
10
10
|
@details = details
|
11
11
|
end
|
12
12
|
|
13
|
-
def uri
|
14
|
-
uri = URI("#{
|
13
|
+
def uri(api_base_url)
|
14
|
+
uri = URI("#{api_base_url}#{ENDPOINT}")
|
15
15
|
uri.query = URI.encode_www_form(params)
|
16
16
|
|
17
17
|
uri
|
@@ -9,8 +9,8 @@ module MicrosoftComputerVision::Api
|
|
9
9
|
@max_candidates = max_candidates
|
10
10
|
end
|
11
11
|
|
12
|
-
def uri
|
13
|
-
uri = URI("#{
|
12
|
+
def uri(api_base_url)
|
13
|
+
uri = URI("#{api_base_url}#{ENDPOINT}")
|
14
14
|
uri.query = URI.encode_www_form(params)
|
15
15
|
|
16
16
|
uri
|
@@ -10,8 +10,8 @@ module MicrosoftComputerVision::Api
|
|
10
10
|
@detect_orientation = detect_orientation
|
11
11
|
end
|
12
12
|
|
13
|
-
def uri
|
14
|
-
uri = URI("#{
|
13
|
+
def uri(api_base_url)
|
14
|
+
uri = URI("#{api_base_url}#{ENDPOINT}")
|
15
15
|
uri.query = URI.encode_www_form(params)
|
16
16
|
|
17
17
|
uri
|
@@ -11,8 +11,8 @@ module MicrosoftComputerVision::Api
|
|
11
11
|
@smart_cropping = smart_cropping
|
12
12
|
end
|
13
13
|
|
14
|
-
def uri
|
15
|
-
uri = URI("#{
|
14
|
+
def uri(api_base_url)
|
15
|
+
uri = URI("#{api_base_url}#{ENDPOINT}")
|
16
16
|
uri.query = URI.encode_www_form(params)
|
17
17
|
|
18
18
|
uri
|
@@ -1,45 +1,43 @@
|
|
1
1
|
module MicrosoftComputerVision
|
2
2
|
class Client
|
3
|
-
|
4
|
-
API_BASE = 'https://api.projectoxford.ai/vision/v1.0'
|
5
|
-
|
6
|
-
def initialize(subscription_key)
|
3
|
+
def initialize(subscription_key, location = "westus")
|
7
4
|
@subscription_key = subscription_key
|
5
|
+
@api_base_url = "https://#{location}.api.cognitive.microsoft.com/vision/v1.0"
|
8
6
|
end
|
9
7
|
|
10
8
|
def analyze(image_path, options)
|
11
9
|
analyze = Api::Analyze.new(options[:visual_features], options[:details])
|
12
|
-
post_image_path(analyze.uri, image_path)
|
10
|
+
post_image_path(analyze.uri(@api_base_url), image_path)
|
13
11
|
end
|
14
12
|
|
15
13
|
def describe(image_path, options)
|
16
14
|
describe = Api::Describe.new(options[:max_candidates])
|
17
|
-
post_image_path(describe.uri, image_path)
|
15
|
+
post_image_path(describe.uri(@api_base_url), image_path)
|
18
16
|
end
|
19
17
|
|
20
18
|
def thumbnail(image_path, options)
|
21
19
|
thumbnail = Api::Thumbnail.new(options[:width], options[:height], options[:smart_cropping])
|
22
|
-
post_image_path(thumbnail.uri, image_path)
|
20
|
+
post_image_path(thumbnail.uri(@api_base_url), image_path)
|
23
21
|
end
|
24
22
|
|
25
23
|
def domain_models
|
26
24
|
domain_models = Api::DomainModels.new()
|
27
|
-
get(domain_models.uri, {}.to_json)
|
25
|
+
get(domain_models.uri(@api_base_url), {}.to_json)
|
28
26
|
end
|
29
27
|
|
30
28
|
def domain_model(image_path, options)
|
31
29
|
domain_model = Api::DomainModel.new(options[:model])
|
32
|
-
post_image_path(domain_model.uri, image_path)
|
30
|
+
post_image_path(domain_model.uri(@api_base_url), image_path)
|
33
31
|
end
|
34
32
|
|
35
33
|
def ocr(image_path, options)
|
36
34
|
ocr = Api::OCR.new(options[:language], options[:detect_orientation])
|
37
|
-
post_image_path(ocr.uri, image_path)
|
35
|
+
post_image_path(ocr.uri(@api_base_url), image_path)
|
38
36
|
end
|
39
37
|
|
40
38
|
def tag(image_path)
|
41
39
|
tag = Api::Tag.new()
|
42
|
-
post_image_path(tag.uri, image_path)
|
40
|
+
post_image_path(tag.uri(@api_base_url), image_path)
|
43
41
|
end
|
44
42
|
|
45
43
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microsoft_computer_vision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- henteko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -129,8 +129,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.5.1
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: This is a very basic wrapper for the Microsoft Computer Vision API.
|
136
136
|
test_files: []
|
137
|
+
has_rdoc:
|