forked from extern/easydiffusion
A better way to make gfpgan show up at the top
This commit is contained in:
parent
e349fb1a23
commit
924fee394a
@ -87,7 +87,7 @@ let promptStrengthField = document.querySelector("#prompt_strength")
|
|||||||
let samplerField = document.querySelector("#sampler_name")
|
let samplerField = document.querySelector("#sampler_name")
|
||||||
let samplerSelectionContainer = document.querySelector("#samplerSelection")
|
let samplerSelectionContainer = document.querySelector("#samplerSelection")
|
||||||
let useFaceCorrectionField = document.querySelector("#use_face_correction")
|
let useFaceCorrectionField = document.querySelector("#use_face_correction")
|
||||||
let gfpganModelField = new ModelDropdown(document.querySelector("#gfpgan_model"), ["codeformer", "gfpgan"])
|
let gfpganModelField = new ModelDropdown(document.querySelector("#gfpgan_model"), ["gfpgan", "codeformer"], "", false)
|
||||||
let useUpscalingField = document.querySelector("#use_upscale")
|
let useUpscalingField = document.querySelector("#use_upscale")
|
||||||
let upscaleModelField = document.querySelector("#upscale_model")
|
let upscaleModelField = document.querySelector("#upscale_model")
|
||||||
let upscaleAmountField = document.querySelector("#upscale_amount")
|
let upscaleAmountField = document.querySelector("#upscale_amount")
|
||||||
@ -2061,10 +2061,3 @@ prettifyInputs(document)
|
|||||||
// set the textbox as focused on start
|
// set the textbox as focused on start
|
||||||
promptField.focus()
|
promptField.focus()
|
||||||
promptField.selectionStart = promptField.value.length
|
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)
|
|
||||||
// })
|
|
||||||
|
@ -38,6 +38,8 @@ class ModelDropdown {
|
|||||||
noneEntry //= ''
|
noneEntry //= ''
|
||||||
modelFilterInitialized //= undefined
|
modelFilterInitialized //= undefined
|
||||||
|
|
||||||
|
sorted //= true
|
||||||
|
|
||||||
/* MIMIC A REGULAR INPUT FIELD */
|
/* MIMIC A REGULAR INPUT FIELD */
|
||||||
get parentElement() {
|
get parentElement() {
|
||||||
return this.modelFilter.parentElement
|
return this.modelFilter.parentElement
|
||||||
@ -83,10 +85,11 @@ class ModelDropdown {
|
|||||||
|
|
||||||
/* SEARCHABLE INPUT */
|
/* SEARCHABLE INPUT */
|
||||||
|
|
||||||
constructor(input, modelKey, noneEntry = "") {
|
constructor(input, modelKey, noneEntry = "", sorted = true) {
|
||||||
this.modelFilter = input
|
this.modelFilter = input
|
||||||
this.noneEntry = noneEntry
|
this.noneEntry = noneEntry
|
||||||
this.modelKey = modelKey
|
this.modelKey = modelKey
|
||||||
|
this.sorted = sorted
|
||||||
|
|
||||||
if (modelsOptions !== undefined) {
|
if (modelsOptions !== undefined) {
|
||||||
// reuse models from cache (only useful for plugins, which are loaded after models)
|
// reuse models from cache (only useful for plugins, which are loaded after models)
|
||||||
@ -566,11 +569,15 @@ class ModelDropdown {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const childFolderNames = Array.from(foldersMap.keys())
|
const childFolderNames = Array.from(foldersMap.keys())
|
||||||
|
if (this.sorted) {
|
||||||
this.sortStringArray(childFolderNames)
|
this.sortStringArray(childFolderNames)
|
||||||
|
}
|
||||||
const folderElements = childFolderNames.map((name) => foldersMap.get(name))
|
const folderElements = childFolderNames.map((name) => foldersMap.get(name))
|
||||||
|
|
||||||
const modelNames = Array.from(modelsMap.keys())
|
const modelNames = Array.from(modelsMap.keys())
|
||||||
|
if (this.sorted) {
|
||||||
this.sortStringArray(modelNames)
|
this.sortStringArray(modelNames)
|
||||||
|
}
|
||||||
const modelElements = modelNames.map((name) => modelsMap.get(name))
|
const modelElements = modelNames.map((name) => modelsMap.get(name))
|
||||||
|
|
||||||
if (modelElements.length && folderName) {
|
if (modelElements.length && folderName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user