Class: StableDiffusionRuby::Configuration
- Inherits:
-
Object
- Object
- StableDiffusionRuby::Configuration
- Defined in:
- lib/stable_diffusion_ruby/configuration.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#modal_endpoint ⇒ Object
Returns the value of attribute modal_endpoint.
-
#presigned_url_expiry ⇒ Object
Returns the value of attribute presigned_url_expiry.
-
#python_dir ⇒ Object
Returns the value of attribute python_dir.
-
#python_executable ⇒ Object
Returns the value of attribute python_executable.
-
#s3_access_key ⇒ Object
Returns the value of attribute s3_access_key.
-
#s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
-
#s3_endpoint ⇒ Object
Returns the value of attribute s3_endpoint.
-
#s3_region ⇒ Object
Returns the value of attribute s3_region.
-
#s3_secret_key ⇒ Object
Returns the value of attribute s3_secret_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #modal_configured? ⇒ Boolean
-
#resolved_python_executable ⇒ Object
Resolve the Python executable to use.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 10 def initialize @modal_endpoint = nil @python_dir = StableDiffusionRuby.python_dir @python_executable = nil @s3_bucket = nil @s3_region = "us-east-1" @s3_endpoint = nil @s3_access_key = nil @s3_secret_key = nil @logger = default_logger @presigned_url_expiry = 3600 end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def logger @logger end |
#modal_endpoint ⇒ Object
Returns the value of attribute modal_endpoint.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def modal_endpoint @modal_endpoint end |
#presigned_url_expiry ⇒ Object
Returns the value of attribute presigned_url_expiry.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def presigned_url_expiry @presigned_url_expiry end |
#python_dir ⇒ Object
Returns the value of attribute python_dir.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def python_dir @python_dir end |
#python_executable ⇒ Object
Returns the value of attribute python_executable.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def python_executable @python_executable end |
#s3_access_key ⇒ Object
Returns the value of attribute s3_access_key.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def s3_access_key @s3_access_key end |
#s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def s3_bucket @s3_bucket end |
#s3_endpoint ⇒ Object
Returns the value of attribute s3_endpoint.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def s3_endpoint @s3_endpoint end |
#s3_region ⇒ Object
Returns the value of attribute s3_region.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def s3_region @s3_region end |
#s3_secret_key ⇒ Object
Returns the value of attribute s3_secret_key.
5 6 7 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 5 def s3_secret_key @s3_secret_key end |
Instance Method Details
#modal_configured? ⇒ Boolean
23 24 25 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 23 def modal_configured? !modal_endpoint.nil? && !modal_endpoint.empty? end |
#resolved_python_executable ⇒ Object
Resolve the Python executable to use. Priority:
-
Explicitly configured python_executable
-
.venv/bin/python3 inside python_dir (if it exists)
-
System python3
31 32 33 34 35 36 |
# File 'lib/stable_diffusion_ruby/configuration.rb', line 31 def resolved_python_executable return python_executable if python_executable venv = File.join(python_dir, ".venv", "bin", "python3") File.exist?(venv) ? venv : "python3" end |