Class: Salesforce::Einstein::V2::VisionClient

Inherits:
Base
  • Object
show all
Defined in:
lib/salesforce/einstein/vision_client.rb

Constant Summary

Constants inherited from Base

Base::BASE_URI

Instance Attribute Summary

Attributes inherited from Base

#access_token, #boundary, #email, #private_key, #timeout

Instance Method Summary collapse

Methods inherited from Base

#delete_reflesh_token, #get_api_usage, #initialize

Constructor Details

This class inherits a constructor from Salesforce::Einstein::Base

Instance Method Details

#all_datasetsObject



25
26
27
# File 'lib/salesforce/einstein/vision_client.rb', line 25

def all_datasets
  get '/vision/datasets'
end

#all_examples(dataset_id) ⇒ Object



53
54
55
# File 'lib/salesforce/einstein/vision_client.rb', line 53

def all_examples(dataset_id)
  get "/vision/datasets/#{dataset_id}/examples"
end

#all_examples_for_label(dataset_id, label_id) ⇒ Object



57
58
59
# File 'lib/salesforce/einstein/vision_client.rb', line 57

def all_examples_for_label(dataset_id, label_id)
  get "/vision/datasets/#{dataset_id}/examples?labelId=#{label_id}"
end

#all_models(dataset_id) ⇒ Object



81
82
83
# File 'lib/salesforce/einstein/vision_client.rb', line 81

def all_models(dataset_id)
  get "/datasets/#{dataset_id}/models"
end

#create_dataset(name, labels, type = 'image') ⇒ Object



21
22
23
# File 'lib/salesforce/einstein/vision_client.rb', line 21

def create_dataset(name, labels, type = 'image')
  post '/vision/datasets', type: type, name: name, labels: labels
end

#create_example(dataset_id, params) ⇒ Object



49
50
51
# File 'lib/salesforce/einstein/vision_client.rb', line 49

def create_example(dataset_id, params)
  post "/vision/datasets/#{dataset_id}/examples", params
end

#create_label(dataset_id, name) ⇒ Object



41
42
43
# File 'lib/salesforce/einstein/vision_client.rb', line 41

def create_label(dataset_id, name)
  post "/vision/datasets/#{dataset_id}/labels", name: name
end

#dataset(dataset_id) ⇒ Object



29
30
31
# File 'lib/salesforce/einstein/vision_client.rb', line 29

def dataset(dataset_id)
  get "/vision/datasets/#{dataset_id}"
end

#delete_dataset(dataset_id) ⇒ Object



33
34
35
# File 'lib/salesforce/einstein/vision_client.rb', line 33

def delete_dataset(dataset_id)
  delete "/vision/datasets/#{dataset_id}"
end

#delete_example(dataset_id, example_id) ⇒ Object



61
62
63
# File 'lib/salesforce/einstein/vision_client.rb', line 61

def delete_example(dataset_id, example_id)
  delete "/vision/datasets/#{dataset_id}/examples/#{example_id}"
end

#deletion_status(deletion_id) ⇒ Object



37
38
39
# File 'lib/salesforce/einstein/vision_client.rb', line 37

def deletion_status(deletion_id)
  get "/vision/deletion/#{deletion_id}"
end

#label(dataset_id, label_id) ⇒ Object



45
46
47
# File 'lib/salesforce/einstein/vision_client.rb', line 45

def label(dataset_id, label_id)
  get "/vision/datasets/#{dataset_id}/labels/#{label_id}"
end

#model_metrics(model_id) ⇒ Object



77
78
79
# File 'lib/salesforce/einstein/vision_client.rb', line 77

def model_metrics(model_id)
  get "/vision/models/#{model_id}"
end

#predict_with_base64(base64_string, modelId = 'GeneralImageClassifier') ⇒ Object

def predict_with_file path, modelId = ‘GeneralImageClassifier’

post '/predict', {sampleContent: path, modelId: modelId}

end



17
18
19
# File 'lib/salesforce/einstein/vision_client.rb', line 17

def predict_with_base64(base64_string, modelId = 'GeneralImageClassifier')
  post '/vision/predict', sampleBase64Content: base64_string, modelId: modelId
end

#predict_with_url(url, modelId = 'GeneralImageClassifier') ⇒ Object



9
10
11
# File 'lib/salesforce/einstein/vision_client.rb', line 9

def predict_with_url(url, modelId = 'GeneralImageClassifier')
  post '/vision/predict', sampleLocation: url, modelId: modelId
end

#retain_dataset(params) ⇒ Object



69
70
71
# File 'lib/salesforce/einstein/vision_client.rb', line 69

def retain_dataset(params)
  post '/vision/retrain', params
end

#train_dataset(params) ⇒ Object



65
66
67
# File 'lib/salesforce/einstein/vision_client.rb', line 65

def train_dataset(params)
  post '/vision/train', params
end

#training_status(model_id) ⇒ Object



73
74
75
# File 'lib/salesforce/einstein/vision_client.rb', line 73

def training_status(model_id)
  get "/vision/train/#{model_id}"
end