Class: StableDiffusionRuby::Client
- Inherits:
-
Object
- Object
- StableDiffusionRuby::Client
- Defined in:
- lib/stable_diffusion_ruby/client.rb
Instance Method Summary collapse
-
#generate(prompt: nil, style: "photorealistic", model: nil, backend: nil) ⇒ Result
Generate an image from a text prompt.
-
#inpaint(image_path:, mask_path:, prompt: nil, model: nil, backend: nil) ⇒ Result
Repaint a masked region of an image using AI inpainting.
-
#outpaint(source_path:, prompt: nil, model: nil, seed_offset: 0, backend: nil) ⇒ Result
Extend a square image to 16:9 using AI outpainting.
Instance Method Details
#generate(prompt: nil, style: "photorealistic", model: nil, backend: nil) ⇒ Result
Generate an image from a text prompt.
28 29 30 31 32 33 34 |
# File 'lib/stable_diffusion_ruby/client.rb', line 28 def generate(prompt: nil, style: "photorealistic", model: nil, backend: nil) params = { style: style } params[:user_prompt] = prompt if prompt params[:model] = model if model execute("generate_image", params, backend: backend) end |
#inpaint(image_path:, mask_path:, prompt: nil, model: nil, backend: nil) ⇒ Result
Repaint a masked region of an image using AI inpainting.
44 45 46 47 48 49 50 |
# File 'lib/stable_diffusion_ruby/client.rb', line 44 def inpaint(image_path:, mask_path:, prompt: nil, model: nil, backend: nil) params = { image_path: image_path, mask_path: mask_path } params[:prompt] = prompt if prompt params[:model] = model if model execute("inpaint_region", params, backend: backend) end |
#outpaint(source_path:, prompt: nil, model: nil, seed_offset: 0, backend: nil) ⇒ Result
Extend a square image to 16:9 using AI outpainting.
13 14 15 16 17 18 19 |
# File 'lib/stable_diffusion_ruby/client.rb', line 13 def outpaint(source_path:, prompt: nil, model: nil, seed_offset: 0, backend: nil) params = { source_path: source_path, seed_offset: seed_offset } params[:prompt] = prompt if prompt params[:model] = model if model execute("outpaint_image", params, backend: backend) end |