Class: Getimg::Client::StableDiffusion

Inherits:
Object
  • Object
show all
Defined in:
lib/getimg/client/stable_diffusion.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ StableDiffusion

Returns a new instance of StableDiffusion.



6
7
8
# File 'lib/getimg/client/stable_diffusion.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#image_to_image(options = {}) ⇒ Object

client.stable_diffusion.image_to_image(

{
  model: "stable-diffusion-v1-5", 
  prompt: "mars", 
  image: Getimg::Image.new.file_to_base64("test.PNG"),
  strength: 0.5, 
  steps: 25,
  guidance: 7.5, 
  output_format: "png"
}

) Getimg::Image.new.base64_to_file(gen)



52
53
54
# File 'lib/getimg/client/stable_diffusion.rb', line 52

def image_to_image(options = {})
  @client.post("/stable-diffusion/image-to-image", options)
end

#text_to_image(options = {}) ⇒ Object

gen = client.stable_diffusion.text_to_image(“stable-diffusion-v1-5”, prompt: “a photo of an astronaut riding a horse”, guidance: 7.5, width: 256, height: 256, steps: 25, output_format: “png”) Getimg::Image.new.base64_to_file(gen)



24
25
26
# File 'lib/getimg/client/stable_diffusion.rb', line 24

def text_to_image(options = {})
  @client.post("/stable-diffusion/text-to-image", options)
end