Class: Roseflow::StabilityAI::Operations::Upscale
- Defined in:
- lib/roseflow/stabilityai/operations/upscale.rb
Instance Method Summary collapse
- #body ⇒ Object
- #esrgan_body ⇒ Object
- #excluded_keys ⇒ Object
- #path ⇒ Object
- #sdx4_body ⇒ Object
- #type ⇒ Object
Methods inherited from Base
Instance Method Details
#body ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/roseflow/stabilityai/operations/upscale.rb', line 39 def body case upscale_type.to_sym when :sdx4 sdx4_body when :esrgan esrgan_body end end |
#esrgan_body ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/roseflow/stabilityai/operations/upscale.rb', line 61 def esrgan_body initial = to_h.except(*excluded_keys) esrgan.to_h.merge( image: Faraday::Multipart::ParamPart.new( esrgan.image, "image/png", ), ).merge(initial) end |
#excluded_keys ⇒ Object
35 36 37 |
# File 'lib/roseflow/stabilityai/operations/upscale.rb', line 35 def excluded_keys [:path, :engine_id, :text_prompts, :upscale_type, :esrgan, :sdx4] end |
#path ⇒ Object
31 32 33 |
# File 'lib/roseflow/stabilityai/operations/upscale.rb', line 31 def path "/v1/generation/#{engine_id}/image-to-image/upscale" end |
#sdx4_body ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/roseflow/stabilityai/operations/upscale.rb', line 48 def sdx4_body initial = to_h.except(*excluded_keys) sdx4.to_h.merge( image: Faraday::Multipart::ParamPart.new( sdx4.image, "image/png", ), text_prompts: sdx4.text_prompts.each_with_index.map do |item, index| [index, item.to_h] end.to_h, ).merge(initial) end |
#type ⇒ Object
71 72 73 |
# File 'lib/roseflow/stabilityai/operations/upscale.rb', line 71 def type :upscale end |