From 958771260944d7da3e3daf9cde5642d1ba7bceec Mon Sep 17 00:00:00 2001 From: Pedro Cuenca Date: Wed, 8 Feb 2023 16:44:47 +0100 Subject: [PATCH] Correctly show safety checker error. --- Diffusion-macOS/StatusView.swift | 2 +- Diffusion/Pipeline/Pipeline.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Diffusion-macOS/StatusView.swift b/Diffusion-macOS/StatusView.swift index 01b91ac..b01461d 100644 --- a/Diffusion-macOS/StatusView.swift +++ b/Diffusion-macOS/StatusView.swift @@ -74,7 +74,7 @@ struct StatusView: View { case .complete(_, let image, let lastSeed, let interval): guard let _ = image else { return HStack { - Text("Safety checker triggered, please try a different prompt or seed") + Text("Safety checker triggered, please try a different prompt or seed.") Spacer() } } diff --git a/Diffusion/Pipeline/Pipeline.swift b/Diffusion/Pipeline/Pipeline.swift index 63b5a78..e706010 100644 --- a/Diffusion/Pipeline/Pipeline.swift +++ b/Diffusion/Pipeline/Pipeline.swift @@ -65,8 +65,8 @@ class Pipeline { let interval = Date().timeIntervalSince(beginDate) print("Got images: \(images) in \(interval)") - // unwrap the 1 image we asked for - guard let image = images.compactMap({ $0 }).first else { throw "Generation failed" } + // Unwrap the 1 image we asked for, nil means safety checker triggered + let image = images.compactMap({ $0 }).first return GenerationResult(image: image, lastSeed: theSeed, interval: interval) }