Module: StableDiffusionRuby::Dispatcher

Defined in:
lib/stable_diffusion_ruby/dispatcher.rb

Constant Summary collapse

VALID_BACKENDS =
%i[modal python].freeze

Class Method Summary collapse

Class Method Details

.backend_for(command, params, backend: nil) ⇒ Object

Returns the appropriate backend for a given command and params.

Parameters:

  • command (String)

    The inference command

  • params (Hash)

    Parameters including optional :model

  • backend (Symbol, nil) (defaults to: nil)

    Explicit backend override (:modal, :python, or nil for auto)



12
13
14
15
16
17
18
19
# File 'lib/stable_diffusion_ruby/dispatcher.rb', line 12

def self.backend_for(command, params, backend: nil)
  if backend
    validate_backend!(backend)
    build_backend(backend, command, params)
  else
    auto_select_backend(command, params)
  end
end