experimental? newer hrfix stuff
This commit is contained in:
parent
ef583a2135
commit
3c596e6a4c
5 changed files with 90 additions and 23 deletions
|
@ -644,3 +644,9 @@ select > .style-select-option:active {
|
||||||
.button.tool.active {
|
.button.tool.active {
|
||||||
background-color: rgb(60, 60, 130);
|
background-color: rgb(60, 60, 130);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Miscellaneous garbage */
|
||||||
|
|
||||||
|
.thirdwidth {
|
||||||
|
max-width: 33%;
|
||||||
|
}
|
||||||
|
|
33
index.html
33
index.html
|
@ -7,7 +7,7 @@
|
||||||
<link href="css/colors.css?v=3f81e80" rel="stylesheet" />
|
<link href="css/colors.css?v=3f81e80" rel="stylesheet" />
|
||||||
<link href="css/icons.css?v=caa702e" rel="stylesheet" />
|
<link href="css/icons.css?v=caa702e" rel="stylesheet" />
|
||||||
|
|
||||||
<link href="css/index.css?v=69d3b9e" rel="stylesheet" />
|
<link href="css/index.css?v=5b8d4d6" rel="stylesheet" />
|
||||||
<link href="css/layers.css?v=b4fbf61" rel="stylesheet" />
|
<link href="css/layers.css?v=b4fbf61" rel="stylesheet" />
|
||||||
|
|
||||||
<link href="css/ui/generic.css?v=4b9afe2" rel="stylesheet" />
|
<link href="css/ui/generic.css?v=4b9afe2" rel="stylesheet" />
|
||||||
|
@ -100,8 +100,31 @@
|
||||||
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
||||||
<label for="cbxHRFix">Apply txt2img HRfix</label>
|
<label for="cbxHRFix">Apply txt2img HRfix</label>
|
||||||
<br />
|
<br />
|
||||||
|
<label class="hrfix">Resize to (>0 overrides scale):</label>
|
||||||
|
<br class="hrfix" />
|
||||||
|
<label for="hrfOutX" class="hrfix">X:</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="hr_resize_x"
|
||||||
|
onchange="changeHRFX()"
|
||||||
|
min="0"
|
||||||
|
max="2048"
|
||||||
|
value="0"
|
||||||
|
step="8"
|
||||||
|
class="hrfix thirdwidth" />
|
||||||
|
<label for="hrfOutY" class="hrfix">Y:</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="hr_resize_y"
|
||||||
|
onchange="changeHRFY()"
|
||||||
|
min="0"
|
||||||
|
max="2048"
|
||||||
|
value="0"
|
||||||
|
step="8"
|
||||||
|
class="hrfix thirdwidth" />
|
||||||
<div id="hrFixScale" class="hrfix"></div>
|
<div id="hrFixScale" class="hrfix"></div>
|
||||||
<div id="hrFixLockPx" class="hrfix"></div>
|
<div id="hrFixLockPx" class="hrfix"></div>
|
||||||
|
<div id="hrFixSteps" class="hrfix"></div>
|
||||||
<label id="hrFixLabel" class="hrfix">Choose HRfix upscaler</label>
|
<label id="hrFixLabel" class="hrfix">Choose HRfix upscaler</label>
|
||||||
<div id="hrFixUpscaler" class="hrfix"></div>
|
<div id="hrFixUpscaler" class="hrfix"></div>
|
||||||
<div id="hrDenoising" class="hrfix"></div>
|
<div id="hrDenoising" class="hrfix"></div>
|
||||||
|
@ -323,7 +346,7 @@
|
||||||
<script src="js/global.js?v=3a1cde6" type="text/javascript"></script>
|
<script src="js/global.js?v=3a1cde6" type="text/javascript"></script>
|
||||||
|
|
||||||
<!-- Base Libs -->
|
<!-- Base Libs -->
|
||||||
<script src="js/lib/util.js?v=7f6847c" type="text/javascript"></script>
|
<script src="js/lib/util.js?v=5838390" type="text/javascript"></script>
|
||||||
<script src="js/lib/events.js?v=2ab7933" type="text/javascript"></script>
|
<script src="js/lib/events.js?v=2ab7933" type="text/javascript"></script>
|
||||||
<script src="js/lib/input.js?v=09298ac" type="text/javascript"></script>
|
<script src="js/lib/input.js?v=09298ac" type="text/javascript"></script>
|
||||||
<script src="js/lib/layers.js?v=a1f8aea" type="text/javascript"></script>
|
<script src="js/lib/layers.js?v=a1f8aea" type="text/javascript"></script>
|
||||||
|
@ -341,7 +364,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=afc36b6" type="text/javascript"></script>
|
<script src="js/index.js?v=87cef1a" type="text/javascript"></script>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
src="js/ui/floating/history.js?v=fc92d14"
|
src="js/ui/floating/history.js?v=fc92d14"
|
||||||
|
@ -352,10 +375,10 @@
|
||||||
|
|
||||||
<!-- Load Tools -->
|
<!-- Load Tools -->
|
||||||
<script
|
<script
|
||||||
src="js/ui/tool/generic.js?v=2bcd36d"
|
src="js/ui/tool/generic.js?v=f1a19a4"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
|
|
||||||
<script src="js/ui/tool/dream.js?v=1f10ae6" type="text/javascript"></script>
|
<script src="js/ui/tool/dream.js?v=0c4379b" 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>
|
||||||
|
|
60
js/index.js
60
js/index.js
|
@ -111,6 +111,9 @@ var stableDiffusionData = {
|
||||||
//firstphase_height: 0, //20230102 welp looks like the entire way HRfix is implemented has become bonkersly different
|
//firstphase_height: 0, //20230102 welp looks like the entire way HRfix is implemented has become bonkersly different
|
||||||
hr_scale: 2.0,
|
hr_scale: 2.0,
|
||||||
hr_upscaler: "None",
|
hr_upscaler: "None",
|
||||||
|
hr_second_pass_steps: 0,
|
||||||
|
hr_resize_x: 0,
|
||||||
|
hr_resize_y: 0,
|
||||||
styles: [],
|
styles: [],
|
||||||
// here's some more fields that might be useful
|
// here's some more fields that might be useful
|
||||||
|
|
||||||
|
@ -679,6 +682,17 @@ const lockPxSlider = makeSlider(
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hrStepsSlider = makeSlider(
|
||||||
|
"HRfix Steps",
|
||||||
|
document.getElementById("hrFixSteps"),
|
||||||
|
"hr_second_pass_steps",
|
||||||
|
0,
|
||||||
|
localStorage.getItem("openoutpaint/settings.max-steps") || 70,
|
||||||
|
5,
|
||||||
|
30,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
function changeMaskBlur() {
|
function changeMaskBlur() {
|
||||||
stableDiffusionData.mask_blur = parseInt(
|
stableDiffusionData.mask_blur = parseInt(
|
||||||
document.getElementById("maskBlur").value
|
document.getElementById("maskBlur").value
|
||||||
|
@ -691,29 +705,45 @@ function changeSeed() {
|
||||||
localStorage.setItem("openoutpaint/seed", stableDiffusionData.seed);
|
localStorage.setItem("openoutpaint/seed", stableDiffusionData.seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeHRFX() {
|
||||||
|
stableDiffusionData.hr_resize_x =
|
||||||
|
document.getElementById("hr_resize_x").value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeHRFY() {
|
||||||
|
stableDiffusionData.hr_resize_y =
|
||||||
|
document.getElementById("hr_resize_y").value;
|
||||||
|
}
|
||||||
|
|
||||||
function changeHiResFix() {
|
function changeHiResFix() {
|
||||||
stableDiffusionData.enable_hr = Boolean(
|
stableDiffusionData.enable_hr = Boolean(
|
||||||
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 hrfSlider = document.getElementById("hrFixScale");
|
||||||
var hrfOpotions = document.getElementById("hrFixUpscaler");
|
// var hrfOpotions = document.getElementById("hrFixUpscaler");
|
||||||
var hrfLabel = document.getElementById("hrFixLabel");
|
// var hrfLabel = document.getElementById("hrFixLabel");
|
||||||
var hrfDenoiseSlider = document.getElementById("hrDenoising");
|
// var hrfDenoiseSlider = document.getElementById("hrDenoising");
|
||||||
var hrfLockPxSlider = document.getElementById("hrFixLockPx");
|
// var hrfLockPxSlider = document.getElementById("hrFixLockPx");
|
||||||
if (stableDiffusionData.enable_hr) {
|
if (stableDiffusionData.enable_hr) {
|
||||||
hrfSlider.classList.remove("invisible");
|
document
|
||||||
hrfOpotions.classList.remove("invisible");
|
.querySelectorAll(".hrfix")
|
||||||
hrfLabel.classList.remove("invisible");
|
.forEach((el) => el.classList.remove("invisible"));
|
||||||
hrfDenoiseSlider.classList.remove("invisible");
|
// hrfSlider.classList.remove("invisible");
|
||||||
hrfLockPxSlider.classList.remove("invisible");
|
// hrfOpotions.classList.remove("invisible");
|
||||||
|
// hrfLabel.classList.remove("invisible");
|
||||||
|
// hrfDenoiseSlider.classList.remove("invisible");
|
||||||
|
// hrfLockPxSlider.classList.remove("invisible");
|
||||||
//state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.add("invisible");
|
//state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.add("invisible");
|
||||||
} else {
|
} else {
|
||||||
hrfSlider.classList.add("invisible");
|
document
|
||||||
hrfOpotions.classList.add("invisible");
|
.querySelectorAll(".hrfix")
|
||||||
hrfLabel.classList.add("invisible");
|
.forEach((el) => el.classList.add("invisible"));
|
||||||
hrfDenoiseSlider.classList.add("invisible");
|
// hrfSlider.classList.add("invisible");
|
||||||
hrfLockPxSlider.classList.add("invisible");
|
// hrfOpotions.classList.add("invisible");
|
||||||
|
// hrfLabel.classList.add("invisible");
|
||||||
|
// hrfDenoiseSlider.classList.add("invisible");
|
||||||
|
// hrfLockPxSlider.classList.add("invisible");
|
||||||
//state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.remove("invisible");
|
//state.ctxmenu.keepUnmaskedBlurSliderLinebreak.classList.remove("invisible");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -844,8 +844,16 @@ const dream_generate_callback = async (bb, resolution, state) => {
|
||||||
|
|
||||||
var newWidth = Math.floor(request.width / request.hr_scale);
|
var newWidth = Math.floor(request.width / request.hr_scale);
|
||||||
var newHeight = Math.floor(request.height / request.hr_scale);
|
var newHeight = Math.floor(request.height / request.hr_scale);
|
||||||
request.width = newWidth;
|
request.hr_resize_x = stableDiffusionData.hr_resize_x;
|
||||||
request.height = newHeight;
|
request.hr_resize_y = stableDiffusionData.hr_resize_y;
|
||||||
|
request.width =
|
||||||
|
stableDiffusionData.hr_resize_x || stableDiffusionData.hr_resize_y > 0
|
||||||
|
? request.width
|
||||||
|
: newWidth;
|
||||||
|
request.height =
|
||||||
|
stableDiffusionData.hr_resize_x || stableDiffusionData.hr_resize_y > 0
|
||||||
|
? request.height
|
||||||
|
: newHeight; //in webUI if _either_ x or y is > 0 then their values are used over scale as per https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/81490780949fffed77493b4bd741e96ec737fe27#diff-ddc07d50fa3b043925b1e831b1373976798d62c9f5c11fcb16c6c830bd3857cdR104
|
||||||
}
|
}
|
||||||
|
|
||||||
// For compatibility with the old HRFix API
|
// For compatibility with the old HRFix API
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<link href="../css/colors.css?v=3f81e80" rel="stylesheet" />
|
<link href="../css/colors.css?v=3f81e80" rel="stylesheet" />
|
||||||
<link href="../css/icons.css?v=caa702e" rel="stylesheet" />
|
<link href="../css/icons.css?v=caa702e" rel="stylesheet" />
|
||||||
|
|
||||||
<link href="../css/index.css?v=69d3b9e" rel="stylesheet" />
|
<link href="../css/index.css?v=5b8d4d6" rel="stylesheet" />
|
||||||
<link href="../css/layers.css?v=b4fbf61" rel="stylesheet" />
|
<link href="../css/layers.css?v=b4fbf61" rel="stylesheet" />
|
||||||
|
|
||||||
<link href="../css/ui/generic.css?v=4b9afe2" rel="stylesheet" />
|
<link href="../css/ui/generic.css?v=4b9afe2" rel="stylesheet" />
|
||||||
|
|
Loading…
Reference in a new issue