From 47ce76ecec1db909ecf6c3ae858635525de0d50e Mon Sep 17 00:00:00 2001 From: Pedro Cuenca Date: Tue, 17 Jan 2023 14:17:04 +0100 Subject: [PATCH] Download model selected in picker. --- Diffusion-macOS/PromptView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Diffusion-macOS/PromptView.swift b/Diffusion-macOS/PromptView.swift index 79cee53..6e707cc 100644 --- a/Diffusion-macOS/PromptView.swift +++ b/Diffusion-macOS/PromptView.swift @@ -35,6 +35,10 @@ struct PromptView: View { @State private var pipelineState: PipelineState = .downloading(0) func modelDidChange(model: ModelInfo) { + print("Loading model \(model)") + Settings.shared.currentModel = model + + pipelineState = .downloading(0) Task.init { let loader = PipelineLoader(model: model) stateSubscriber = loader.statePublisher.sink { state in @@ -78,7 +82,8 @@ struct PromptView: View { } } .onChange(of: model) { theModel in - print("Model changed to \(theModel) model: \(model)") + guard let model = ModelInfo.from(modelVersion: theModel) else { return } + modelDidChange(model: model) } } label: { Label("Model", systemImage: "cpu").foregroundColor(.secondary)