Merge branch 'testing' into manual-scripts because i wanted the iP2P in scripts branch and probably did this backwards but oh well

# Conflicts:
#	index.html
#	js/index.js
This commit is contained in:
tim h 2023-02-09 19:21:40 -06:00
commit ba56052ec1
3 changed files with 48 additions and 3 deletions

View file

@ -250,7 +250,7 @@
<br /> <br />
<span id="version"> <span id="version">
<a href="https://github.com/zero01101/openOutpaint" target="_blank"> <a href="https://github.com/zero01101/openOutpaint" target="_blank">
Alpha release v0.0.14 Alpha release v0.0.14.2
</a> </a>
<br /> <br />
<a <a
@ -447,7 +447,7 @@
<!-- Content --> <!-- Content -->
<script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script> <script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script>
<script src="js/index.js?v=e87f7bf" type="text/javascript"></script> <script src="js/index.js?v=c113c17" type="text/javascript"></script>
<script <script
src="js/ui/floating/history.js?v=4f29db4" src="js/ui/floating/history.js?v=4f29db4"
@ -461,7 +461,7 @@
src="js/ui/tool/generic.js?v=3e678e0" src="js/ui/tool/generic.js?v=3e678e0"
type="text/javascript"></script> type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=fc1c6f7" type="text/javascript"></script> <script src="js/ui/tool/dream.js?v=991f6c4" type="text/javascript"></script>
<script <script
src="js/ui/tool/maskbrush.js?v=d88810f" src="js/ui/tool/maskbrush.js?v=d88810f"
type="text/javascript"></script> type="text/javascript"></script>

View file

@ -606,6 +606,13 @@ let modelAutoComplete = createAutoComplete(
"refreshable" "refreshable"
); );
modelAutoComplete.onchange.on(({value}) => { 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")) if (value.toLowerCase().includes("inpainting"))
document.querySelector( document.querySelector(
"#models-ac-select input.autocomplete-text" "#models-ac-select input.autocomplete-text"
@ -1410,3 +1417,22 @@ function changeScript(evt) {
} }
} }
} }
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

@ -1087,6 +1087,7 @@ const dream_generate_callback = async (bb, resolution, state) => {
); );
request.mask = maskCanvas.toDataURL(); request.mask = maskCanvas.toDataURL();
request.inpainting_fill = stableDiffusionData.outpainting_fill; request.inpainting_fill = stableDiffusionData.outpainting_fill;
request.image_cfg_scale = stableDiffusionData.image_cfg_scale;
// Dream // Dream
_generate("img2img", request, bb, { _generate("img2img", request, bb, {
@ -1167,6 +1168,7 @@ const dream_img2img_callback = (bb, resolution, state) => {
request.denoising_strength = state.denoisingStrength; request.denoising_strength = state.denoisingStrength;
request.inpainting_fill = state.inpainting_fill ?? 1; //let's see how this works //1; // For img2img use original request.inpainting_fill = state.inpainting_fill ?? 1; //let's see how this works //1; // For img2img use original
request.image_cfg_scale = state.image_cfg_scale ?? 0.5; // what am i even doing
// Load prompt (maybe we should add some events so we don't have to do this) // Load prompt (maybe we should add some events so we don't have to do this)
request.prompt = document.getElementById("prompt").value; request.prompt = document.getElementById("prompt").value;
@ -2361,6 +2363,22 @@ const img2imgTool = () =>
textStep: 1, textStep: 1,
} }
).slider; ).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); menu.appendChild(state.ctxmenu.cursorSizeSlider);
@ -2376,6 +2394,7 @@ const img2imgTool = () =>
// menu.appendChild(state.ctxmenu.keepUnmaskedBlurSliderLinebreak); // menu.appendChild(state.ctxmenu.keepUnmaskedBlurSliderLinebreak);
menu.appendChild(state.ctxmenu.inpaintTypeSelect); menu.appendChild(state.ctxmenu.inpaintTypeSelect);
menu.appendChild(state.ctxmenu.denoisingStrengthSlider); menu.appendChild(state.ctxmenu.denoisingStrengthSlider);
menu.appendChild(state.ctxmenu.instructPix2PixImgCfgLabel);
const btnArray2 = document.createElement("div"); const btnArray2 = document.createElement("div");
btnArray2.classList.add("checkbox-array"); btnArray2.classList.add("checkbox-array");
btnArray2.appendChild(state.ctxmenu.fullResolutionLabel); btnArray2.appendChild(state.ctxmenu.fullResolutionLabel);