lib/gen_ai/image/stability_ai.rb in gen-ai-0.4.0 vs lib/gen_ai/image/stability_ai.rb in gen-ai-0.4.1

- old
+ new

@@ -25,9 +25,27 @@ model: model, parsed: parse_response_data(response['artifacts']) ) end + def variations(image, options = {}) + model = options[:model] || DEFAULT_MODEL + url = "/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image" + + response = client.post url, { + init_image: File.binread(image), + image_strength: 0.3, + 'text_prompts[0][text]' => "Portrait of old Jim Morrison at age of 60, handsome, color, phot-realistic, 50mm, crisp, high-res, depth of field, composition", + 'text_prompts[0][weight]' => 0.7 + }, multipart: true + + build_result( + raw: response, + model: model, + parsed: parse_response_data(response['artifacts']) + ) + end + def edit(image, prompt, options = {}) model = options[:model] || DEFAULT_MODEL url = "/v1/generation/#{model}/image-to-image" response = client.post url, build_edit_body(image, prompt, options), multipart: true