Class: Roseflow::StabilityAI::Operations::ImageToImage

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

Instance Method Summary collapse

Methods inherited from Base

#multipart?

Instance Method Details

#bodyObject



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

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

#excluded_keysObject



31
32
33
# File 'lib/roseflow/stabilityai/operations/image_to_image.rb', line 31

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

#pathObject



23
24
25
# File 'lib/roseflow/stabilityai/operations/image_to_image.rb', line 23

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

#typeObject



27
28
29
# File 'lib/roseflow/stabilityai/operations/image_to_image.rb', line 27

def type
  :image_to_image
end