Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

marclove/soothsayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soothsayer

Soothsayer is a thin Ruby wrapper around Google's Prediction API.

Setup

Go to Google's API Console. Sign up and turn on both the "Google Cloud Storage" and "Prediction API" services. Before you can use the Prediction API, you'll have to turn on billing.

Go to "API Access" section of the Google API Console and create an "Authorized API Access" key, "Client ID for installed applications." You'll need the "Client ID" and "Client secret."

Download Google's Ruby API client gem:

gem install google-api-client

Now you need to download your OAuth keys

google-api oauth-2-login --scope=https://www.googleapis.com/auth/prediction --client-id=<< YOUR CLIENT ID >> --client-secret=<< YOUR CLIENT SECRET >>

This will create a file at ~/.google-api.yaml which contains your OAuth keys. Move this file into your project and use it to configure Soothsayer:

config_file = File.expand_path('path/to/google-api.yaml')
config = open(config_file, 'r'){ |file| YAML.load(file.read) }
Soothsayer.config do |c|
  c.client_id     = config['client_id']
  c.client_secret = config['client_secret']
  c.access_token  = config['access_token']
  c.refresh_token = config['refresh_token']
end

Usage

To use Soothsayer, refer to Google's documentation.

Soothsayer::HostedModel.predict("sample.languageid", {:input => {:csvInstance => ["Como se llama?"]}})
Soothsayer::TrainedModel.list
Soothsayer::TrainedModel.update("my.trained.model.name", {:label => "my_label", :csvInstance => [col1, col2, col3]})

About

A Ruby client for Google's Prediction API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages