Class: RubyLLM::Agents::BackgroundRemover
- Inherits:
-
Object
- Object
- RubyLLM::Agents::BackgroundRemover
- Extended by:
- DSL
- Includes:
- Execution
- Defined in:
- lib/ruby_llm/agents/image/background_remover.rb,
lib/ruby_llm/agents/image/background_remover/dsl.rb,
lib/ruby_llm/agents/image/background_remover/execution.rb
Overview
Background remover for subject extraction
Removes backgrounds from images using segmentation models, producing transparent PNGs or masked outputs.
Defined Under Namespace
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
Class Method Summary collapse
-
.call(image:, **options) ⇒ BackgroundRemovalResult
Execute background removal.
-
.inherited(subclass) ⇒ Object
Ensure subclasses inherit DSL settings.
Instance Method Summary collapse
-
#call ⇒ BackgroundRemovalResult
Execute the background removal.
-
#initialize(image:, **options) ⇒ BackgroundRemover
constructor
Initialize a new background remover instance.
Methods included from Execution
Constructor Details
#initialize(image:, **options) ⇒ BackgroundRemover
Initialize a new background remover instance
75 76 77 78 79 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 75 def initialize(image:, **) @image = image @options = @tenant_id = nil end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
63 64 65 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 63 def image @image end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
63 64 65 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 63 def @options end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
63 64 65 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 63 def tenant_id @tenant_id end |
Class Method Details
.call(image:, **options) ⇒ BackgroundRemovalResult
Execute background removal
42 43 44 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 42 def call(image:, **) new(image: image, **).call end |
.inherited(subclass) ⇒ Object
Ensure subclasses inherit DSL settings
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 47 def inherited(subclass) super subclass.instance_variable_set(:@model, @model) subclass.instance_variable_set(:@output_format, @output_format) subclass.instance_variable_set(:@refine_edges, @refine_edges) subclass.instance_variable_set(:@alpha_matting, @alpha_matting) subclass.instance_variable_set(:@foreground_threshold, @foreground_threshold) subclass.instance_variable_set(:@background_threshold, @background_threshold) subclass.instance_variable_set(:@erode_size, @erode_size) subclass.instance_variable_set(:@return_mask, @return_mask) subclass.instance_variable_set(:@version, @version) subclass.instance_variable_set(:@description, @description) subclass.instance_variable_set(:@cache_ttl, @cache_ttl) end |
Instance Method Details
#call ⇒ BackgroundRemovalResult
Execute the background removal
84 85 86 |
# File 'lib/ruby_llm/agents/image/background_remover.rb', line 84 def call execute end |