Sha256: 52c5a33b235b5478275ef636d1d223b0dbe16ce96c0bbe56c90ee96c08869145
Contents?: true
Size: 861 Bytes
Versions: 1
Compression:
Stored size: 861 Bytes
Contents
# frozen_string_literal: true module GenAI class Image def initialize(provider, token, options: {}) build_client(provider, token, options) end def generate(prompt, options = {}) client.generate(prompt, options) end def variations(image, options = {}) client.variations(image, options) end def edit(image, prompt, options = {}) client.edit(image, prompt, options) end # def upscale; end private attr_reader :client def build_client(provider, token, options) klass = GenAI::Image.constants.find do |const| const.to_s.downcase == provider.to_s.downcase.gsub('_', '') end raise UnsupportedProvider, "Unsupported Image provider '#{provider}'" unless klass @client = GenAI::Image.const_get(klass).new(token: token, options: options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gen-ai-0.2.0 | lib/gen_ai/image.rb |