Merge pull request #149 from zero01101/outpaint_type

user-adjustable outpaint (inpaint) type separated from... actual inpaint type
This commit is contained in:
tim h 2023-01-03 17:25:16 -06:00 committed by GitHub
commit a3cfebff3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 5 deletions

View file

@ -340,7 +340,7 @@
<!-- Content -->
<script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script>
<script src="js/index.js?v=adcbc46" type="text/javascript"></script>
<script src="js/index.js?v=62ccd18" type="text/javascript"></script>
<script
src="js/ui/floating/history.js?v=fc92d14"
@ -354,7 +354,7 @@
src="js/ui/tool/generic.js?v=2bcd36d"
type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=7c80563" type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=d408feb" type="text/javascript"></script>
<script
src="js/ui/tool/maskbrush.js?v=1e8a893"
type="text/javascript"></script>

View file

@ -103,7 +103,8 @@ var stableDiffusionData = {
mask: "",
init_images: [],
inpaint_full_res: false,
inpainting_fill: 2,
inpainting_fill: 1,
outpainting_fill: 2,
enable_hr: false,
restore_faces: false,
//firstphase_width: 0,
@ -344,9 +345,13 @@ async function testHostConnection() {
);
const optionsdata = await response.json();
if (optionsdata["use_scale_latent_for_hires_fix"]) {
const message = `You are using an outdated version of A1111 webUI.\nThe HRfix options will not work until you update to at least commit ef27a18\n(https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/ef27a18b6b7cb1a8eebdc9b2e88d25baf2c2414d)\nor newer.`;
const message = `You are using an outdated version of A1111 webUI.\nThe HRfix options will not work until you update to at least commit ef27a18 or newer.\n(https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/ef27a18b6b7cb1a8eebdc9b2e88d25baf2c2414d)\nHRfix options have been disabled.`;
console.error(message);
alert(message);
if (notify) alert(message);
document
.getElementById("cbxHRFix")
.setAttribute("disabled", "disabled");
stableDiffusionData.enable_hr = false;
}
switch (response.status) {
case 200: {
@ -563,6 +568,7 @@ const hrFixUpscalerAutoComplete = createAutoComplete(
"HRfix Upscaler",
document.getElementById("hrFixUpscaler")
);
hrFixUpscalerAutoComplete.onchange.on(({value}) => {
stableDiffusionData.hr_upscaler = value;
localStorage.setItem(`openoutpaint/hr_upscaler`, value);

View file

@ -927,6 +927,7 @@ const dream_generate_callback = async (bb, resolution, state) => {
request.height
);
request.mask = maskCanvas.toDataURL();
request.inpainting_fill = stableDiffusionData.outpainting_fill;
// Dream
_generate("img2img", request, bb, {
@ -1538,6 +1539,23 @@ const dreamTool = () =>
"invisible"
);
// outpaint fill type select list
state.ctxmenu.outpaintTypeSelect = _toolbar_input.selectlist(
state,
"outpainting_fill",
"Outpaint Type",
{
0: "fill",
1: "original (AVOID)",
2: "latent noise (suggested)",
3: "latent nothing",
},
2, // AVOID ORIGINAL FOR OUTPAINT OR ELSE but we still give you the option because we love you
() => {
stableDiffusionData.outpainting_fill = state.outpainting_fill;
}
).label;
// Preserve Brushed Masks Checkbox
state.ctxmenu.preserveMasksLabel = _toolbar_input.checkbox(
state,
@ -1587,6 +1605,7 @@ const dreamTool = () =>
// menu.appendChild(state.ctxmenu.keepUnmaskedBlurSliderLinebreak);
// menu.appendChild(state.ctxmenu.preserveMasksLabel);
// menu.appendChild(document.createElement("br"));
menu.appendChild(state.ctxmenu.outpaintTypeSelect);
menu.appendChild(state.ctxmenu.overMaskPxLabel);
menu.appendChild(state.ctxmenu.eagerGenerateCountLabel);
},