From 4f799a2bf077b3c22aa186361fb2f8019d424fc9 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 8 Jun 2023 15:52:41 +0530 Subject: [PATCH] Use gfpgan as the default model for face restoration --- ui/media/js/main.js | 7 +++++++ ui/media/js/searchable-models.js | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 5909fdb1..54e7042a 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -2061,3 +2061,10 @@ prettifyInputs(document) // set the textbox as focused on start promptField.focus() promptField.selectionStart = promptField.value.length + +// use gfpgan as the default model for face restoration +document.addEventListener("refreshModels", function() { + let gfpganIdx = gfpganModelField.inputModels.findIndex((e) => e.toLowerCase().startsWith("gfpgan")) + let gfpganElem = gfpganModelField.modelElements[gfpganIdx] + gfpganModelField.selectModelEntry(gfpganElem) +}) diff --git a/ui/media/js/searchable-models.js b/ui/media/js/searchable-models.js index 855cfc61..2b72aaa6 100644 --- a/ui/media/js/searchable-models.js +++ b/ui/media/js/searchable-models.js @@ -103,7 +103,6 @@ class ModelDropdown { "refreshModels", this.bind(function(e) { // reload the models - this.inputModels = modelsOptions[this.modelKey] this.inputModels = [] let modelKeys = Array.isArray(this.modelKey) ? this.modelKey : [this.modelKey] for (let i = 0; i < modelKeys.length; i++) {