Class: Roseflow::StabilityAI::Operations::Masking

Inherits:
Base
  • Object
show all
Defined in:
lib/roseflow/stabilityai/operations/masking.rb

Instance Method Summary collapse

Methods inherited from Base

#multipart?

Instance Method Details

#bodyObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/roseflow/stabilityai/operations/masking.rb', line 32

def body
  to_h.except(*excluded_keys).merge(
    init_image: Faraday::Multipart::ParamPart.new(
      init_image,
      "image/png",
    ),
    # mask_image: Faraday::Multipart::ParamPart.new(
    #   mask_image,
    #   "image/png",
    # ),
    text_prompts: text_prompts.each_with_index.map do |item, index|
      [index, item.to_h]
    end.to_h,
  )
end

#excluded_keysObject



28
29
30
# File 'lib/roseflow/stabilityai/operations/masking.rb', line 28

def excluded_keys
  [:path, :engine_id, :text_prompts, :mask_image]
end

#pathObject



24
25
26
# File 'lib/roseflow/stabilityai/operations/masking.rb', line 24

def path
  "/v1/generation/#{engine_id}/image-to-image/masking"
end

#typeObject



48
49
50
# File 'lib/roseflow/stabilityai/operations/masking.rb', line 48

def type
  :masking
end