updates hardcoded schedulers to API call for webUI 1.9.3
This commit is contained in:
parent
4117b83a64
commit
b5d89ab685
2 changed files with 45 additions and 17 deletions
21
index.html
21
index.html
|
@ -1,4 +1,4 @@
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en-US">
|
<html lang="en-US">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@ -137,20 +137,7 @@
|
||||||
<label>Sampler:</label>
|
<label>Sampler:</label>
|
||||||
<div id="sampler-ac-select"></div>
|
<div id="sampler-ac-select"></div>
|
||||||
<label>Scheduler:</label>
|
<label>Scheduler:</label>
|
||||||
<br />
|
<div id="scheduler-ac-select"></div>
|
||||||
<select
|
|
||||||
id="schedulerSelect"
|
|
||||||
name="schedulerSelect"
|
|
||||||
onchange="changeScheduler()">
|
|
||||||
<option value="Automatic" selected="selected">Automatic</option>
|
|
||||||
<option value="Uniform">Uniform</option>
|
|
||||||
<option value="Karras">Karras</option>
|
|
||||||
<option value="Exponential">Exponential</option>
|
|
||||||
<option value="Polyexponential">Polyexponential</option>
|
|
||||||
<option value="SGM Uniform">SGM Uniform</option>
|
|
||||||
</select>
|
|
||||||
<!-- TODO scheduler isn't exposed via API that i can tell, un-hardcode when that's changed, add to localstorage settings, turn into magic type search autocomplete selectbox, disable selected attribute, all the stuff -->
|
|
||||||
<br />
|
|
||||||
<label for="seed">Seed (-1 for random):</label>
|
<label for="seed">Seed (-1 for random):</label>
|
||||||
<br />
|
<br />
|
||||||
<input
|
<input
|
||||||
|
@ -352,7 +339,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">
|
||||||
v20240413.001
|
v20240427.001
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
<a
|
<a
|
||||||
|
@ -575,7 +562,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=6e33053" type="text/javascript"></script>
|
<script src="js/index.js?v=5fc4006" type="text/javascript"></script>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
src="js/ui/floating/history.js?v=4f29db4"
|
src="js/ui/floating/history.js?v=4f29db4"
|
||||||
|
|
41
js/index.js
41
js/index.js
|
@ -424,6 +424,7 @@ async function testHostConnection() {
|
||||||
getSamplers();
|
getSamplers();
|
||||||
getUpscalers();
|
getUpscalers();
|
||||||
getModels();
|
getModels();
|
||||||
|
getSchedulers();
|
||||||
extensions.getExtensions(
|
extensions.getExtensions(
|
||||||
controlNetModelAutoComplete,
|
controlNetModelAutoComplete,
|
||||||
controlNetModuleAutoComplete,
|
controlNetModuleAutoComplete,
|
||||||
|
@ -680,6 +681,11 @@ const samplerAutoComplete = createAutoComplete(
|
||||||
document.getElementById("sampler-ac-select")
|
document.getElementById("sampler-ac-select")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const schedulerAutoComplete = createAutoComplete(
|
||||||
|
"Scheduler",
|
||||||
|
document.getElementById("scheduler-ac-select")
|
||||||
|
);
|
||||||
|
|
||||||
const upscalerAutoComplete = createAutoComplete(
|
const upscalerAutoComplete = createAutoComplete(
|
||||||
"Upscaler",
|
"Upscaler",
|
||||||
document.getElementById("upscaler-ac-select")
|
document.getElementById("upscaler-ac-select")
|
||||||
|
@ -1441,6 +1447,41 @@ async function getSamplers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getSchedulers() {
|
||||||
|
var url = document.getElementById("host").value + "/sdapi/v1/schedulers";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url);
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
schedulerAutoComplete.onchange.on(({value}) => {
|
||||||
|
stableDiffusionData.scheduler = value;
|
||||||
|
localStorage.setItem("openoutpaint/scheduler", value);
|
||||||
|
});
|
||||||
|
|
||||||
|
schedulerAutoComplete.options = data.map((scheduler) => ({
|
||||||
|
name: scheduler.label,
|
||||||
|
value: scheduler.label,
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (localStorage.getItem("openoutpaint/scheduler") != null) {
|
||||||
|
schedulerAutoComplete.value = localStorage.getItem(
|
||||||
|
"openoutpaint/scheduler"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
schedulerAutoComplete.value = data[0].name;
|
||||||
|
localStorage.setItem(
|
||||||
|
"openoutpaint/scheduler",
|
||||||
|
schedulerAutoComplete.value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
stableDiffusionData.scheduler = schedulerAutoComplete.value;
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[index] Failed to fetch schedulers");
|
||||||
|
console.warn(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function upscaleAndDownload(
|
async function upscaleAndDownload(
|
||||||
download = false,
|
download = false,
|
||||||
add_resource = false,
|
add_resource = false,
|
||||||
|
|
Loading…
Reference in a new issue