Add restore faces option

Add restore faces option; Resolves #129

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-12-29 00:37:18 -03:00
parent be19ba0439
commit a628c45717
2 changed files with 24 additions and 1 deletions

View file

@ -100,6 +100,12 @@
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" /> <input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
<label for="cbxHRFix">Auto txt2img HRfix</label> <label for="cbxHRFix">Auto txt2img HRfix</label>
<br /> <br />
<input
type="checkbox"
id="cbxRestoreFaces"
onchange="changeRestoreFaces()" />
<label for="cbxRestoreFaces">Restore Faces</label>
<br />
<input <input
type="checkbox" type="checkbox"
id="cbxSyncCursorSize" id="cbxSyncCursorSize"
@ -328,7 +334,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=36e55fc" type="text/javascript"></script> <script src="js/index.js?v=3feb99d" type="text/javascript"></script>
<script <script
src="js/ui/floating/history.js?v=fc92d14" src="js/ui/floating/history.js?v=fc92d14"

View file

@ -105,6 +105,7 @@ var stableDiffusionData = {
inpaint_full_res: false, inpaint_full_res: false,
inpainting_fill: 2, inpainting_fill: 2,
enable_hr: false, enable_hr: false,
restore_faces: false,
firstphase_width: 0, firstphase_width: 0,
firstphase_height: 0, firstphase_height: 0,
styles: [], styles: [],
@ -158,6 +159,7 @@ function startup() {
changeSmoothRendering(); changeSmoothRendering();
changeSeed(); changeSeed();
changeHiResFix(); changeHiResFix();
changeRestoreFaces();
changeSyncCursorSize(); changeSyncCursorSize();
} }
@ -616,6 +618,16 @@ function changeHiResFix() {
localStorage.setItem("openoutpaint/enable_hr", stableDiffusionData.enable_hr); localStorage.setItem("openoutpaint/enable_hr", stableDiffusionData.enable_hr);
} }
function changeRestoreFaces() {
stableDiffusionData.restore_faces = Boolean(
document.getElementById("cbxRestoreFaces").checked
);
localStorage.setItem(
"openoutpaint/restore_faces",
stableDiffusionData.restore_faces
);
}
function changeSyncCursorSize() { function changeSyncCursorSize() {
stableDiffusionData.sync_cursor_size = Boolean( stableDiffusionData.sync_cursor_size = Boolean(
document.getElementById("cbxSyncCursorSize").checked document.getElementById("cbxSyncCursorSize").checked
@ -1007,6 +1019,10 @@ function loadSettings() {
localStorage.getItem("openoutpaint/enable_hr") === null localStorage.getItem("openoutpaint/enable_hr") === null
? false ? false
: localStorage.getItem("openoutpaint/enable_hr") === "true"; : localStorage.getItem("openoutpaint/enable_hr") === "true";
let _restore_faces =
localStorage.getItem("openoutpaint/restore_faces") === null
? false
: localStorage.getItem("openoutpaint/restore_faces") === "true";
let _sync_cursor_size = let _sync_cursor_size =
localStorage.getItem("openoutpaint/sync_cursor_size") === null localStorage.getItem("openoutpaint/sync_cursor_size") === null
@ -1017,6 +1033,7 @@ function loadSettings() {
document.getElementById("maskBlur").value = Number(_mask_blur); document.getElementById("maskBlur").value = Number(_mask_blur);
document.getElementById("seed").value = Number(_seed); document.getElementById("seed").value = Number(_seed);
document.getElementById("cbxHRFix").checked = Boolean(_enable_hr); document.getElementById("cbxHRFix").checked = Boolean(_enable_hr);
document.getElementById("cbxRestoreFaces").checked = Boolean(_restore_faces);
document.getElementById("cbxSyncCursorSize").checked = document.getElementById("cbxSyncCursorSize").checked =
Boolean(_sync_cursor_size); Boolean(_sync_cursor_size);
} }