Sha256: 8568d988b8625135cd81e02beff7899ca71ece5173a9fa504fd9cd7995ea4868
Contents?: true
Size: 898 Bytes
Versions: 13
Compression:
Stored size: 898 Bytes
Contents
module OpenAI class Images def initialize(access_token: nil, organization_id: nil) OpenAI.configuration.access_token = access_token if access_token OpenAI.configuration.organization_id = organization_id if organization_id end def generate(parameters: {}) OpenAI::Client.json_post(path: "/images/generations", parameters: parameters) end def edit(parameters: {}) OpenAI::Client.multipart_post(path: "/images/edits", parameters: open_files(parameters)) end def variations(parameters: {}) OpenAI::Client.multipart_post(path: "/images/variations", parameters: open_files(parameters)) end private def open_files(parameters) parameters = parameters.merge(image: File.open(parameters[:image])) parameters = parameters.merge(mask: File.open(parameters[:mask])) if parameters[:mask] parameters end end end
Version data entries
13 entries across 13 versions & 2 rubygems