forked from extern/easydiffusion
Hide the hypernetwork strength slider if no hypernetwork model is selected; Support drag-n-drop for hypernetwork models
This commit is contained in:
parent
b53935bfd4
commit
8c032579b8
@ -194,6 +194,28 @@ const TASK_MAPPING = {
|
||||
readUI: () => vaeModelField.value,
|
||||
parse: (val) => val
|
||||
},
|
||||
use_hypernetwork_model: { name: 'Hypernetwork model',
|
||||
setUI: (use_hypernetwork_model) => {
|
||||
const oldVal = hypernetworkModelField.value
|
||||
|
||||
if (use_hypernetwork_model !== '') {
|
||||
use_hypernetwork_model = getModelPath(use_hypernetwork_model, ['.pt'])
|
||||
use_hypernetwork_model = use_hypernetwork_model !== '' ? use_hypernetwork_model : oldVal
|
||||
}
|
||||
hypernetworkModelField.value = use_hypernetwork_model
|
||||
hypernetworkModelField.dispatchEvent(new Event('change'))
|
||||
},
|
||||
readUI: () => hypernetworkModelField.value,
|
||||
parse: (val) => val
|
||||
},
|
||||
hypernetwork_strength: { name: 'Hypernetwork Strength',
|
||||
setUI: (hypernetwork_strength) => {
|
||||
hypernetworkStrengthField.value = hypernetwork_strength
|
||||
updateHypernetworkStrengthSlider()
|
||||
},
|
||||
readUI: () => parseFloat(hypernetworkStrengthField.value),
|
||||
parse: (val) => parseFloat(val)
|
||||
},
|
||||
|
||||
num_outputs: { name: 'Parallel Images',
|
||||
setUI: (num_outputs) => {
|
||||
@ -338,7 +360,9 @@ const TASK_TEXT_MAPPING = {
|
||||
use_upscale: 'Use Upscaling',
|
||||
sampler: 'Sampler',
|
||||
negative_prompt: 'Negative Prompt',
|
||||
use_stable_diffusion_model: 'Stable Diffusion model'
|
||||
use_stable_diffusion_model: 'Stable Diffusion model',
|
||||
use_hypernetwork_model: 'Hypernetwork model',
|
||||
hypernetwork_strength: 'Hypernetwork Strength'
|
||||
}
|
||||
const afterPromptRe = /^\s*Width\s*:\s*\d+\s*(?:\r\n|\r|\n)+\s*Height\s*:\s*\d+\s*(\r\n|\r|\n)+Seed\s*:\s*\d+\s*$/igm
|
||||
function parseTaskFromText(str) {
|
||||
|
@ -1175,6 +1175,12 @@ hypernetworkStrengthSlider.addEventListener('input', updateHypernetworkStrength)
|
||||
hypernetworkStrengthField.addEventListener('input', updateHypernetworkStrengthSlider)
|
||||
updateHypernetworkStrength()
|
||||
|
||||
function updateHypernetworkStrengthContainer() {
|
||||
document.querySelector("#hypernetwork_strength_container").style.display = (hypernetworkModelField.value === "" ? 'none' : '')
|
||||
}
|
||||
hypernetworkModelField.addEventListener('change', updateHypernetworkStrengthContainer)
|
||||
updateHypernetworkStrengthContainer()
|
||||
|
||||
/********************* JPEG Quality **********************/
|
||||
function updateOutputQuality() {
|
||||
outputQualityField.value = 0 | outputQualitySlider.value
|
||||
@ -1249,6 +1255,10 @@ async function getModels() {
|
||||
vaeOptions.forEach(createModelOptions(vaeModelField, selectedVaeModel))
|
||||
hypernetworkOptions.forEach(createModelOptions(hypernetworkModelField, selectedHypernetworkModel))
|
||||
|
||||
stableDiffusionModelField.dispatchEvent(new Event('change'))
|
||||
vaeModelField.dispatchEvent(new Event('change'))
|
||||
hypernetworkModelField.dispatchEvent(new Event('change'))
|
||||
|
||||
// TODO: set default for model here too
|
||||
SETTINGS[sd_model_setting_key].default = stableDiffusionOptions[0]
|
||||
if (getSetting(sd_model_setting_key) == '' || SETTINGS[sd_model_setting_key].value == '') {
|
||||
|
Loading…
Reference in New Issue
Block a user