Use negative prompts.

pull/12/head
Pedro Cuenca 1 year ago
parent 01b64111ab
commit 172995d210

@ -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,

@ -48,7 +48,7 @@ class GenerationContext: ObservableObject {
func generate() async -> (CGImage, TimeInterval)? {
guard let pipeline = pipeline else { return nil }
let seed = self.seed >= 0 ? UInt32(self.seed) : nil
return try? pipeline.generate(prompt: positivePrompt, scheduler: scheduler, numInferenceSteps: Int(steps), seed: seed)
return try? pipeline.generate(prompt: positivePrompt, negativePrompt: negativePrompt, scheduler: scheduler, numInferenceSteps: Int(steps), seed: seed)
}
}

Loading…
Cancel
Save