|
|
|
@ -29,12 +29,13 @@ class Pipeline {
|
|
|
|
|
self.pipeline = pipeline
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func generate(prompt: String, scheduler: StableDiffusionScheduler, numInferenceSteps stepCount: Int = 50, seed: UInt32? = nil) throws -> (CGImage, TimeInterval) {
|
|
|
|
|
func generate(prompt: String, negativePrompt: String = "", scheduler: StableDiffusionScheduler, numInferenceSteps stepCount: Int = 50, seed: UInt32? = nil) throws -> (CGImage, TimeInterval) {
|
|
|
|
|
let beginDate = Date()
|
|
|
|
|
print("Generating...")
|
|
|
|
|
let theSeed = seed ?? UInt32.random(in: 0..<UInt32.max)
|
|
|
|
|
let images = try pipeline.generateImages(
|
|
|
|
|
prompt: prompt,
|
|
|
|
|
negativePrompt: negativePrompt,
|
|
|
|
|
imageCount: 1,
|
|
|
|
|
stepCount: stepCount,
|
|
|
|
|
seed: theSeed,
|
|
|
|
|