Class: Replicate::Client

Inherits:
Object
  • Object
show all
Includes:
Model, Prediction, Training, Upload, Configurable
Defined in:
lib/replicate/client.rb,
lib/replicate/client/model.rb,
lib/replicate/client/upload.rb,
lib/replicate/client/training.rb,
lib/replicate/client/prediction.rb

Defined Under Namespace

Modules: Model, Prediction, Training, Upload

Instance Attribute Summary

Attributes included from Configurable

#api_endpoint_url, #api_token, #dreambooth_endpoint_url, #webhook_url

Instance Method Summary collapse

Methods included from Training

#create_training, #retrieve_training

Methods included from Upload

#create_upload, #update_upload, #upload_zip

Methods included from Prediction

#cancel_prediction, #create_prediction, #list_predictions, #retrieve_prediction

Methods included from Model

#retrieve_collection, #retrieve_model

Methods included from Configurable

#configure, keys

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



20
21
22
23
24
25
26
# File 'lib/replicate/client.rb', line 20

def initialize(options = {})
  # Use options passed in, but fall back to module defaults
  Replicate::Configurable.keys.each do |key|
    value = options.key?(key) ? options[key] : Replicate.instance_variable_get(:"@#{key}")
    instance_variable_set(:"@#{key}", value)
  end
end

Instance Method Details

#api_endpointObject



28
29
30
# File 'lib/replicate/client.rb', line 28

def api_endpoint
  @api_endpoint ||= Replicate::Endpoint.new(endpoint_url: api_endpoint_url, api_token: api_token)
end

#dreambooth_endpointObject



32
33
34
# File 'lib/replicate/client.rb', line 32

def dreambooth_endpoint
  @dreambooth_endpoint ||= Replicate::Endpoint.new(endpoint_url: dreambooth_endpoint_url, api_token: api_token)
end