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">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
@ -137,20 +137,7 @@
|
|||
<label>Sampler:</label>
|
||||
<div id="sampler-ac-select"></div>
|
||||
<label>Scheduler:</label>
|
||||
<br />
|
||||
<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 />
|
||||
<div id="scheduler-ac-select"></div>
|
||||
<label for="seed">Seed (-1 for random):</label>
|
||||
<br />
|
||||
<input
|
||||
|
@ -352,7 +339,7 @@
|
|||
<br />
|
||||
<span id="version">
|
||||
<a href="https://github.com/zero01101/openOutpaint" target="_blank">
|
||||
v20240413.001
|
||||
v20240427.001
|
||||
</a>
|
||||
<br />
|
||||
<a
|
||||
|
@ -575,7 +562,7 @@
|
|||
|
||||
<!-- Content -->
|
||||
<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
|
||||
src="js/ui/floating/history.js?v=4f29db4"
|
||||
|
|
41
js/index.js
41
js/index.js
|
@ -424,6 +424,7 @@ async function testHostConnection() {
|
|||
getSamplers();
|
||||
getUpscalers();
|
||||
getModels();
|
||||
getSchedulers();
|
||||
extensions.getExtensions(
|
||||
controlNetModelAutoComplete,
|
||||
controlNetModuleAutoComplete,
|
||||
|
@ -680,6 +681,11 @@ const samplerAutoComplete = createAutoComplete(
|
|||
document.getElementById("sampler-ac-select")
|
||||
);
|
||||
|
||||
const schedulerAutoComplete = createAutoComplete(
|
||||
"Scheduler",
|
||||
document.getElementById("scheduler-ac-select")
|
||||
);
|
||||
|
||||
const upscalerAutoComplete = createAutoComplete(
|
||||
"Upscaler",
|
||||
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(
|
||||
download = false,
|
||||
add_resource = false,
|
||||
|
|
Loading…
Reference in a new issue