initial changes for instruct-pix2pix img2img

i'd still like the new slider to disappear if not using an iP2P model ergo not in main yet but also not "new" enough of a feature to deserve its own branch, literally just a new field to pass along with POSTs and an associated slider input
This commit is contained in:
tim h 2023-02-04 14:28:01 -06:00
parent a0e7608d06
commit e6c54d4b56
3 changed files with 46 additions and 3 deletions

View file

@ -250,7 +250,7 @@
<br />
<span id="version">
<a href="https://github.com/zero01101/openOutpaint" target="_blank">
Alpha release v0.0.14
Alpha release v0.0.14.1
</a>
<br />
<a
@ -419,7 +419,7 @@
<!-- Content -->
<script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script>
<script src="js/index.js?v=e2f6c36" type="text/javascript"></script>
<script src="js/index.js?v=562739c" type="text/javascript"></script>
<script
src="js/ui/floating/history.js?v=4f29db4"
@ -433,7 +433,7 @@
src="js/ui/tool/generic.js?v=3e678e0"
type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=7bdcf21" type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=6e62c85" type="text/javascript"></script>
<script
src="js/ui/tool/maskbrush.js?v=d88810f"
type="text/javascript"></script>

View file

@ -604,6 +604,13 @@ let modelAutoComplete = createAutoComplete(
"refreshable"
);
modelAutoComplete.onchange.on(({value}) => {
/**
* TODO implement optional API call to check model unet channel count
* extension users guaranteed to have it as of
* https://github.com/zero01101/openOutpaint-webUI-extension/commit/1f22f5ea5b860c6e91f77edfb47743a124596dec
* but still need a fallback check like below
*/
if (value.toLowerCase().includes("inpainting"))
document.querySelector(
"#models-ac-select input.autocomplete-text"
@ -1357,3 +1364,22 @@ function checkFocus() {
focused = true;
}
}
function togglePix2PixImgCfg(value) {
// super hacky
// actually doesn't work at all yet so i'm leaving it here to taunt and remind me of my failures
try {
if (value.toLowerCase().includes("pix2pix")) {
document
.querySelector(".instruct-pix2pix-img-cfg")
.classList.remove("invisible");
} else {
document
.querySelector(".instruct-pix2pix-img-cfg")
.classList.add("invisible");
}
} catch (e) {
// highly likely not currently using img2img tool, do nothing
}
}

View file

@ -2306,6 +2306,22 @@ const img2imgTool = () =>
textStep: 1,
}
).slider;
// img cfg scale slider for instruct-pix2pix
state.ctxmenu.instructPix2PixImgCfgLabel = _toolbar_input.slider(
state,
"image_cfg_scale",
"iP2P Image CFG Scale",
{
min: 0,
max: 30,
step: 1,
textStep: 0.1,
}
).slider;
state.ctxmenu.instructPix2PixImgCfgLabel.classList.add(
"instruct-pix2pix-img-cfg"
);
}
menu.appendChild(state.ctxmenu.cursorSizeSlider);
@ -2320,6 +2336,7 @@ const img2imgTool = () =>
// menu.appendChild(state.ctxmenu.keepUnmaskedBlurSliderLinebreak);
menu.appendChild(state.ctxmenu.inpaintTypeSelect);
menu.appendChild(state.ctxmenu.denoisingStrengthSlider);
menu.appendChild(state.ctxmenu.instructPix2PixImgCfgLabel);
const btnArray2 = document.createElement("div");
btnArray2.classList.add("checkbox-array");
btnArray2.appendChild(state.ctxmenu.fullResolutionLabel);