class Multitagger::Provider::Microsoft
Public Class Methods
new(config)
click to toggle source
# File lib/multitagger/provider/microsoft.rb, line 7 def initialize(config) @client = MicrosoftComputerVision::Client.new(config["key"]) end
Public Instance Methods
tag(image)
click to toggle source
# File lib/multitagger/provider/microsoft.rb, line 11 def tag(image) result = @client.analyze image, {visual_features: "Tags"} data = JSON.parse result.body data["tags"].map { |x| Tag.new(x["name"], x["confidence"]) } end