sigh
This commit is contained in:
parent
304da0ec9e
commit
43d4239824
3 changed files with 83 additions and 51 deletions
14
index.html
14
index.html
|
@ -98,9 +98,11 @@
|
||||||
step="1" />
|
step="1" />
|
||||||
<br />
|
<br />
|
||||||
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
||||||
<label for="cbxHRFix">Auto txt2img HRfix</label>
|
<label for="cbxHRFix">Apply txt2img HRfix</label>
|
||||||
<br />
|
<br />
|
||||||
<div id="hrFixLock"></div>
|
<div id="hrFixScale"></div>
|
||||||
|
<label id="hrFixLabel">Choose HRfix upscaler</label>
|
||||||
|
<div id="hrFixUpscaler"></div>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="cbxRestoreFaces"
|
id="cbxRestoreFaces"
|
||||||
|
@ -118,8 +120,6 @@
|
||||||
<div id="cfgScale"></div>
|
<div id="cfgScale"></div>
|
||||||
<div id="batchSize"></div>
|
<div id="batchSize"></div>
|
||||||
<div id="batchCount"></div>
|
<div id="batchCount"></div>
|
||||||
</div>
|
|
||||||
<!-- Unsectioned -->
|
|
||||||
<label for="maskBlur">Mask blur:</label>
|
<label for="maskBlur">Mask blur:</label>
|
||||||
<span id="maskBlurText"></span>
|
<span id="maskBlurText"></span>
|
||||||
<br />
|
<br />
|
||||||
|
@ -139,6 +139,8 @@
|
||||||
checked
|
checked
|
||||||
onchange="changeSmoothRendering()" />
|
onchange="changeSmoothRendering()" />
|
||||||
<label for="cbxSmooth">Smooth Rendering</label>
|
<label for="cbxSmooth">Smooth Rendering</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Save/load image section -->
|
<!-- Save/load image section -->
|
||||||
<button type="button" class="collapsible">Save/Upscaling</button>
|
<button type="button" class="collapsible">Save/Upscaling</button>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -337,7 +339,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=133b74b" type="text/javascript"></script>
|
<script src="js/index.js?v=eae1998" type="text/javascript"></script>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
src="js/ui/floating/history.js?v=fc92d14"
|
src="js/ui/floating/history.js?v=fc92d14"
|
||||||
|
@ -351,7 +353,7 @@
|
||||||
src="js/ui/tool/generic.js?v=2bcd36d"
|
src="js/ui/tool/generic.js?v=2bcd36d"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
|
|
||||||
<script src="js/ui/tool/dream.js?v=832aa62" type="text/javascript"></script>
|
<script src="js/ui/tool/dream.js?v=6d1e673" type="text/javascript"></script>
|
||||||
<script
|
<script
|
||||||
src="js/ui/tool/maskbrush.js?v=1e8a893"
|
src="js/ui/tool/maskbrush.js?v=1e8a893"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
|
|
59
js/index.js
59
js/index.js
|
@ -106,8 +106,10 @@ var stableDiffusionData = {
|
||||||
inpainting_fill: 2,
|
inpainting_fill: 2,
|
||||||
enable_hr: false,
|
enable_hr: false,
|
||||||
restore_faces: false,
|
restore_faces: false,
|
||||||
firstphase_width: 0,
|
//firstphase_width: 0,
|
||||||
firstphase_height: 0,
|
//firstphase_height: 0, //20230102 welp looks like the entire way HRfix is implemented has become bonkersly different
|
||||||
|
hr_scale: 2.0,
|
||||||
|
hr_upscaler: "None",
|
||||||
styles: [],
|
styles: [],
|
||||||
// here's some more fields that might be useful
|
// here's some more fields that might be useful
|
||||||
|
|
||||||
|
@ -552,6 +554,14 @@ const upscalerAutoComplete = createAutoComplete(
|
||||||
document.getElementById("upscaler-ac-select")
|
document.getElementById("upscaler-ac-select")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hrFixUpscalerAutoComplete = createAutoComplete(
|
||||||
|
"HRfix Upscaler",
|
||||||
|
document.getElementById("hrFixUpscaler")
|
||||||
|
);
|
||||||
|
hrFixUpscalerAutoComplete.onchange.on(({value}) => {
|
||||||
|
stableDiffusionData.hr_upscaler = value;
|
||||||
|
});
|
||||||
|
|
||||||
const resSlider = makeSlider(
|
const resSlider = makeSlider(
|
||||||
"Resolution",
|
"Resolution",
|
||||||
document.getElementById("resolution"),
|
document.getElementById("resolution"),
|
||||||
|
@ -563,8 +573,6 @@ const resSlider = makeSlider(
|
||||||
2,
|
2,
|
||||||
(v) => {
|
(v) => {
|
||||||
stableDiffusionData.width = stableDiffusionData.height = v;
|
stableDiffusionData.width = stableDiffusionData.height = v;
|
||||||
stableDiffusionData.firstphase_width =
|
|
||||||
stableDiffusionData.firstphase_height = v / 2;
|
|
||||||
|
|
||||||
toolbar.currentTool &&
|
toolbar.currentTool &&
|
||||||
toolbar.currentTool.redraw &&
|
toolbar.currentTool.redraw &&
|
||||||
|
@ -621,15 +629,16 @@ makeSlider(
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 20230102 grumble grumble
|
||||||
makeSlider(
|
makeSlider(
|
||||||
"HRfix Lock Px.",
|
"HRfix Scale",
|
||||||
document.getElementById("hrFixLock"),
|
document.getElementById("hrFixScale"),
|
||||||
"hr_fix_lock_px",
|
"hr_scale",
|
||||||
0.0,
|
1.0,
|
||||||
768.0,
|
4.0,
|
||||||
256.0,
|
0.1,
|
||||||
0.0,
|
2.0,
|
||||||
1.0
|
0.1
|
||||||
);
|
);
|
||||||
|
|
||||||
function changeMaskBlur() {
|
function changeMaskBlur() {
|
||||||
|
@ -649,6 +658,20 @@ function changeHiResFix() {
|
||||||
document.getElementById("cbxHRFix").checked
|
document.getElementById("cbxHRFix").checked
|
||||||
);
|
);
|
||||||
localStorage.setItem("openoutpaint/enable_hr", stableDiffusionData.enable_hr);
|
localStorage.setItem("openoutpaint/enable_hr", stableDiffusionData.enable_hr);
|
||||||
|
var hrfSlider = document.getElementById("hrFixScale");
|
||||||
|
var hrfOpotions = document.getElementById("hrFixUpscaler");
|
||||||
|
var hrfLabel = document.getElementById("hrFixLabel");
|
||||||
|
if (stableDiffusionData.enable_hr) {
|
||||||
|
hrfSlider.classList.remove("invisible");
|
||||||
|
hrfOpotions.classList.remove("invisible");
|
||||||
|
hrfLabel.classList.remove("invisible");
|
||||||
|
//state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.add("invisible");
|
||||||
|
} else {
|
||||||
|
hrfSlider.classList.add("invisible");
|
||||||
|
hrfOpotions.classList.add("invisible");
|
||||||
|
hrfLabel.classList.add("invisible");
|
||||||
|
//state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.remove("invisible");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeRestoreFaces() {
|
function changeRestoreFaces() {
|
||||||
|
@ -743,17 +766,23 @@ async function getUpscalers() {
|
||||||
"[index] purposefully_incorrect_data response, ignore above error"
|
"[index] purposefully_incorrect_data response, ignore above error"
|
||||||
);
|
);
|
||||||
// result = purposefully_incorrect_data response: Invalid upscaler, needs to be on of these: None , Lanczos , Nearest , LDSR , BSRGAN , R-ESRGAN General 4xV3 , R-ESRGAN 4x+ Anime6B , ScuNET , ScuNET PSNR , SwinIR_4x
|
// result = purposefully_incorrect_data response: Invalid upscaler, needs to be on of these: None , Lanczos , Nearest , LDSR , BSRGAN , R-ESRGAN General 4xV3 , R-ESRGAN 4x+ Anime6B , ScuNET , ScuNET PSNR , SwinIR_4x
|
||||||
const upscalers = data.detail
|
const upscalersPlusNone = data.detail
|
||||||
.split(": ")[1]
|
.split(": ")[1]
|
||||||
.split(",")
|
.split(",")
|
||||||
.map((v) => v.trim())
|
.map((v) => v.trim()); // need "None" for stupid hrfix changes razza frazza
|
||||||
.filter((v) => v !== "None"); // converting the result to a list of upscalers
|
const upscalers = upscalersPlusNone.filter((v) => v !== "None"); // converting the result to a list of upscalers
|
||||||
|
upscalersPlusNone.push("Latent");
|
||||||
|
upscalersPlusNone.push("Latent (nearest)"); // GRUMBLE GRUMBLE
|
||||||
|
|
||||||
upscalerAutoComplete.options = upscalers.map((u) => {
|
upscalerAutoComplete.options = upscalers.map((u) => {
|
||||||
return {name: u, value: u};
|
return {name: u, value: u};
|
||||||
});
|
});
|
||||||
|
hrFixUpscalerAutoComplete.options = upscalersPlusNone.map((u) => {
|
||||||
|
return {name: u, value: u};
|
||||||
|
});
|
||||||
|
|
||||||
upscalerAutoComplete.value = upscalers[0];
|
upscalerAutoComplete.value = upscalers[0];
|
||||||
|
hrFixUpscalerAutoComplete.value = upscalersPlusNone[0];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("[index] Failed to fetch upscalers:");
|
console.warn("[index] Failed to fetch upscalers:");
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
|
|
|
@ -1387,18 +1387,6 @@ const dreamTool = () =>
|
||||||
h: stableDiffusionData.height,
|
h: stableDiffusionData.height,
|
||||||
};
|
};
|
||||||
|
|
||||||
//hacky set non-square auto hrfix values
|
|
||||||
let hrLockPx =
|
|
||||||
localStorage.getItem("openoutpaint/hr_fix_lock_px") ?? 0;
|
|
||||||
stableDiffusionData.firstphase_height =
|
|
||||||
hrLockPx == 0 || resolution.h / 2 <= hrLockPx
|
|
||||||
? resolution.h / 2
|
|
||||||
: hrLockPx;
|
|
||||||
stableDiffusionData.firstphase_width =
|
|
||||||
hrLockPx == 0 || resolution.w / 2 <= hrLockPx
|
|
||||||
? resolution.w / 2
|
|
||||||
: hrLockPx;
|
|
||||||
|
|
||||||
if (global.connection === "online") {
|
if (global.connection === "online") {
|
||||||
dream_generate_callback(bb, resolution, state);
|
dream_generate_callback(bb, resolution, state);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1492,8 +1480,14 @@ const dreamTool = () =>
|
||||||
state.ctxmenu.keepUnmaskedBlurSlider.classList.remove(
|
state.ctxmenu.keepUnmaskedBlurSlider.classList.remove(
|
||||||
"invisible"
|
"invisible"
|
||||||
);
|
);
|
||||||
|
state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.add(
|
||||||
|
"invisible"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
state.ctxmenu.keepUnmaskedBlurSlider.classList.add("invisible");
|
state.ctxmenu.keepUnmaskedBlurSlider.classList.add("invisible");
|
||||||
|
state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.remove(
|
||||||
|
"invisible"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).label;
|
).label;
|
||||||
|
@ -1511,6 +1505,12 @@ const dreamTool = () =>
|
||||||
}
|
}
|
||||||
).slider;
|
).slider;
|
||||||
|
|
||||||
|
state.ctxmenu.keepUnmaskedBlurSliderLinebreak =
|
||||||
|
document.createElement("br");
|
||||||
|
state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.add(
|
||||||
|
"invisible"
|
||||||
|
);
|
||||||
|
|
||||||
// Preserve Brushed Masks Checkbox
|
// Preserve Brushed Masks Checkbox
|
||||||
state.ctxmenu.preserveMasksLabel = _toolbar_input.checkbox(
|
state.ctxmenu.preserveMasksLabel = _toolbar_input.checkbox(
|
||||||
state,
|
state,
|
||||||
|
@ -1552,6 +1552,7 @@ const dreamTool = () =>
|
||||||
menu.appendChild(document.createElement("br"));
|
menu.appendChild(document.createElement("br"));
|
||||||
menu.appendChild(state.ctxmenu.keepUnmaskedLabel);
|
menu.appendChild(state.ctxmenu.keepUnmaskedLabel);
|
||||||
menu.appendChild(state.ctxmenu.keepUnmaskedBlurSlider);
|
menu.appendChild(state.ctxmenu.keepUnmaskedBlurSlider);
|
||||||
|
menu.appendChild(state.ctxmenu.keepUnmaskedBlurSliderLinebreak);
|
||||||
menu.appendChild(state.ctxmenu.preserveMasksLabel);
|
menu.appendChild(state.ctxmenu.preserveMasksLabel);
|
||||||
menu.appendChild(document.createElement("br"));
|
menu.appendChild(document.createElement("br"));
|
||||||
menu.appendChild(state.ctxmenu.overMaskPxLabel);
|
menu.appendChild(state.ctxmenu.overMaskPxLabel);
|
||||||
|
|
Loading…
Reference in a new issue