nicholalexander/clarification

View on GitHub
bin/console

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require "bundler/setup"
require "clarification"
require "yaml"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

Clarification.configure do |config|
  config.api_key = 'f7cc628178994e16b2470ae739ef927a'
  config.default_public_models = [:food, :general]
end

@images = YAML.load_file("spec/fixtures/images.yml")
        
@urls = [ @images[:mountains], @images[:kitten], @images[:drake] ]

# models = [:apparel,
#          # :celebrity,
#          # :color,
#          # :demographics,
#          # :face_detection,
#          # :face_embedding,
#          # :focus,
#          # :food,
#          # :general,  
#          # :general_embedding,
#          # :logo,
#          # :moderation,
#          # :nsfw,
#          # :travel,
#          # :wedding ]

@client = Clarification::Client.new
# @target_url = @images[:kitten]
# @response = @client.predict.by_url(@target_url)

# @client.search.index_image
# @client.search.by_concepts
# @client.search.by_images

# @url = @images[:faces]
# @concepts = ["faces", "people", "humans"]
# @response = @client.train.add_image(@url, @concepts)
# @model = @client.train.create_model('faces', @concepts)
# @client.train.train_model(model)

# @client.set_active_models([model])

# (If you use this, don't forget to add pry to your Gemfile!)
require "pry"
Pry.start