Sha256: 00fc3338f8147df32af7e7bdf67dc164a59799dcf4c512a2ae8652804606dd47
Contents?: true
Size: 570 Bytes
Versions: 4
Compression:
Stored size: 570 Bytes
Contents
# frozen_string_literal: true module QuickOpenAI module Dalle2 def self.dalle2(prompt, **options) parameters = { prompt: prompt, **options } response = QuickOpenAI.fetch_response_from_client do |client| client.images.generate(parameters: parameters) end results = response.fetch("data") tempfiles = results.map do |result| url = result["url"] Down.download(url) end if tempfiles.size == 1 tempfiles.first else tempfiles end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
quick_openai-0.1.3 | lib/quick_openai/dalle2.rb |
quick_openai-0.1.2 | lib/quick_openai/dalle2.rb |
quick_openai-0.1.1 | lib/quick_openai/dalle2.rb |
quick_openai-0.1.0 | lib/quick_openai/dalle2.rb |