clarifai-rails 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c39c147a05f29329235122744b6b83c8d4975cb
4
- data.tar.gz: cda67986574fc8a87b27345e9afeb74a0c7e0b24
3
+ metadata.gz: 7ec6cb47fe9430f6955e30b556064dc36d935d91
4
+ data.tar.gz: cee70b8d106f79441f5eeb7196f4c187867ab71f
5
5
  SHA512:
6
- metadata.gz: 57624358d02d08c999f6bff12bc5a69890d141eb8fd3b4d375b80ded2610d25f5f6e000a8e56ac90a03cc93e6fa04107516add9a2deb813d33b5aa541bf98d83
7
- data.tar.gz: 3941691e80d0adad8c2147a23c615116b024faaed1de462b2047c0b795fc406483046c65b7b9eba0f6c52fab339ad9ed1760e5a45f489b3e5c7dd43fe375d433
6
+ metadata.gz: 6e5c0a11a0591358b5144905d8a74de5daead9fe359ca3e846fb9c92bd8efe872691580d87fb387bb6f1b7f1e7bc0b378ad7b30da2104b1fbe1084de0f3da4d6
7
+ data.tar.gz: 3a339979ad5f2a64f5c3f91725f4f45e4eac94989059425dda9681238f8f4bcd0aad56974d53bf7d8aeb52d371445463da218cdcfd09f5401f378804faa3a169
data/README.md CHANGED
@@ -1,7 +1,3 @@
1
- # Clarifai::Rails
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/clarifai/rails`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
1
  ## Installation
6
2
 
7
3
  Add this line to your application's Gemfile:
@@ -24,7 +20,7 @@ Or install it yourself as:
24
20
 
25
21
  $ rails g clarifai:install
26
22
 
27
- ### Config Client ID, Client Secret
23
+ ### Config API-KEY and Model code
28
24
 
29
25
  Insert your application info in ```config/initializers/clarifai.rb```
30
26
 
@@ -34,6 +30,11 @@ Insert your application info in ```config/initializers/clarifai.rb```
34
30
  Clarifai::Rails::Detector.new(image_url).image
35
31
  ```
36
32
 
33
+ Custom model code
34
+ ```ruby
35
+ Clarifai::Rails::Detector.new(image_url, model_code).image
36
+ ```
37
+
37
38
  Return ```Clarifai::Rails::Image``` object
38
39
 
39
40
  ### For multiple images
@@ -42,14 +43,9 @@ Return ```Clarifai::Rails::Image``` object
42
43
  Clarifai::Rails::Detector.new([image_url_1, image_url_2]).images
43
44
  ```
44
45
 
45
- Return array ```Clarifai::Rails::Image``` object
46
-
47
- ### If you want to download images before detect (Facebook images, ...)
48
-
46
+ Custom model code
49
47
  ```ruby
50
- clarifai_detector = Clarifai::Rails::Detector.new([image_url_1, image_url_2])
51
- clarifai_detector.need_download!
52
- clarifai_detector.images
48
+ Clarifai::Rails::Detector.new([image_url_1, image_url_2], model_code).images
53
49
  ```
54
50
 
55
51
  Return array ```Clarifai::Rails::Image``` object
@@ -58,17 +54,17 @@ Return array ```Clarifai::Rails::Image``` object
58
54
 
59
55
  With ```image``` is ```Clarifai::Rails::Image``` object
60
56
 
61
- #### Get tags
57
+ #### Get concepts
62
58
 
63
59
  ```ruby
64
- image.tags
60
+ image.concepts
65
61
  ```
66
- Return for you is a String array, it is tags list
62
+ Return for you is a String array, it is concepts list
67
63
 
68
- #### Get tags with percent in image
64
+ #### Get concepts with percent in image
69
65
 
70
66
  ```ruby
71
- image.tags_with_percent
67
+ image.concepts_with_percent
72
68
  ```
73
69
  Return is a Hash with key is tag and value is percent
74
70
 
@@ -77,21 +73,16 @@ Return is a Hash with key is tag and value is percent
77
73
  ```ruby
78
74
  image.url
79
75
  ```
80
- Return ia a String
76
+ Return is a String
81
77
 
82
78
  #### Get docid
83
79
 
84
80
  ```ruby
85
81
  image.docid
86
82
  ```
87
- Return ia a Number
88
-
89
- #### Get docid_str
83
+ Return is a Number
90
84
 
91
- ```ruby
92
- image.docid_str
93
- ```
94
- Return ia a String
85
+ Return is a String
95
86
 
96
87
  #### Check status
97
88
 
@@ -109,7 +100,7 @@ AND
109
100
  ```ruby
110
101
  image.status_code
111
102
  ```
112
- Return ia a String
103
+ Return is a String
113
104
 
114
105
  Can you see more info at https://developer.clarifai.com/docs/status_codes
115
106
 
@@ -118,7 +109,7 @@ Can you see more info at https://developer.clarifai.com/docs/status_codes
118
109
  ```ruby
119
110
  image.status_messages
120
111
  ```
121
- Return ia a String
112
+ Return is a String
122
113
 
123
114
  ## Development
124
115
 
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 1.10"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_dependency "rest-client", "1.8"
32
+ spec.add_dependency "rest-client", "2.1.0.rc1"
33
33
  end
@@ -7,11 +7,13 @@ module Clarifai
7
7
  end
8
8
 
9
9
  def docid
10
- json[:docid]
10
+ json[:id]
11
11
  end
12
12
 
13
13
  def url
14
- json[:url]
14
+ json[:input]['data']['image']['url']
15
+ rescue
16
+ nil
15
17
  end
16
18
 
17
19
  def concepts
@@ -33,10 +35,6 @@ module Clarifai
33
35
  status[:description]
34
36
  end
35
37
 
36
- def docid_str
37
- data[:docid_str]
38
- end
39
-
40
38
  def error
41
39
  Clarifai::Rails::Error.detector(status_code)
42
40
  end
@@ -1,5 +1,5 @@
1
1
  module Clarifai
2
2
  module Rails
3
- VERSION = "0.2.0"
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -1,7 +1,6 @@
1
1
  Clarifai::Rails.setup do |config|
2
2
 
3
- config.client_id = "your clarifai client id"
4
-
5
- config.client_secret = "your clarifai client secret"
3
+ config.api_key = 'Your clarifai api key'
4
+ config.model_code = 'aaa03c23b3724a16a56b629203edc62c'
6
5
 
7
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clarifai-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khoa Nguyen
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '1.8'
47
+ version: 2.1.0.rc1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '1.8'
54
+ version: 2.1.0.rc1
55
55
  description: Clarifai API Rails Client
56
56
  email:
57
57
  - thanhkhoait@gmail.com