Skip to content

Commit

Permalink
Add support for mask parameter for edit image
Browse files Browse the repository at this point in the history
  • Loading branch information
alchaplinsky committed Oct 22, 2023
1 parent 931eeff commit ba8d4b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/gen_ai/image/stability_ai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ def build_generation_body(prompt, options)
end

def build_edit_body(image, prompt, options)
{
params = {
init_image: File.binread(image),
'text_prompts[0][text]' => prompt,
'text_prompts[0][weight]' => 1.0
}.merge(options)
}
params.merge!(mask: File.binread(options.delete(:mask))) if options[:mask]
params.merge(options)
end

def size(options)
Expand Down

0 comments on commit ba8d4b8

Please sign in to comment.