Class: Multitagger::Provider::Google

Inherits:
Object
  • Object
show all
Defined in:
lib/multitagger/provider/google.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Google

Returns a new instance of Google.



6
7
8
# File 'lib/multitagger/provider/google.rb', line 6

def initialize(config)
  @vision = ::Google::Cloud.vision(config["project"], config["keyfile"])
end

Instance Method Details

#tag(image) ⇒ Object



10
11
12
13
# File 'lib/multitagger/provider/google.rb', line 10

def tag(image)
  img = @vision.image(image)
  img.labels.map { |x| Tag.new(x.description, x.score) }
end