Method: Stability::Client#generate_core
- Defined in:
- lib/stability/client.rb
#generate_core(prompt, options: {}, json: false) ⇒ Object
Performs a text-to-image generation request to the Stability API using Stable Image Core.
48 49 50 51 52 53 54 55 |
# File 'lib/stability/client.rb', line 48 def generate_core(prompt, options: {}, json: false) headers = { "Accept" => json ? "application/json" : "image/*" } parameters = { prompt: }.merge() multipart_post(path: "/stable-image/generate/core", headers:, parameters:).tap do |response| raise ServerError, "Empty response from Stability. Might be worth retrying once or twice." if response.blank? raise ServerError, response.dig("error", "message") if response.dig("error", "message").present? end.with_indifferent_access end |