mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
add reference models
This commit is contained in:
@@ -5,7 +5,7 @@ function extensions_apply(extensions_disabled_list, extensions_update_list, disa
|
||||
if (x.name.startsWith('enable_') && !x.checked) disable.push(x.name.substring(7));
|
||||
if (x.name.startsWith('update_') && x.checked) update.push(x.name.substring(7));
|
||||
});
|
||||
restart_reload();
|
||||
restartReload();
|
||||
log('Extensions apply:', { disable, update });
|
||||
return [JSON.stringify(disable), JSON.stringify(update), disable_all];
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ onAfterUiUpdate(async () => {
|
||||
const jsdata = textarea.value;
|
||||
updateOpts(jsdata);
|
||||
executeCallbacks(optionsChangedCallbacks);
|
||||
register_drag_drop();
|
||||
registerDragDrop();
|
||||
|
||||
Object.defineProperty(textarea, 'value', {
|
||||
set(newValue) {
|
||||
|
||||
+17
-11
@@ -211,7 +211,7 @@ function recalculate_prompts_inpaint(...args) {
|
||||
return Array.from(arguments);
|
||||
}
|
||||
|
||||
function register_drag_drop() {
|
||||
function registerDragDrop() {
|
||||
const qs = gradioApp().getElementById('quicksettings');
|
||||
if (!qs) return;
|
||||
qs.addEventListener('dragover', (evt) => {
|
||||
@@ -297,7 +297,7 @@ function getTranslation(...args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function monitor_server_status() {
|
||||
function monitorServerStatus() {
|
||||
document.open();
|
||||
document.write(`
|
||||
<html>
|
||||
@@ -305,12 +305,12 @@ function monitor_server_status() {
|
||||
<body style="background: #222222; font-size: 1rem; font-family:monospace; margin-top:20%; color:lightgray; text-align:center">
|
||||
<h1>Waiting for server...</h1>
|
||||
<script>
|
||||
function monitor_server_status() {
|
||||
function monitorServerStatus() {
|
||||
fetch('/sdapi/v1/progress')
|
||||
.then((res) => { !res?.ok ? setTimeout(monitor_server_status, 1000) : location.reload(); })
|
||||
.catch((e) => setTimeout(monitor_server_status, 1000))
|
||||
.then((res) => { !res?.ok ? setTimeout(monitorServerStatus, 1000) : location.reload(); })
|
||||
.catch((e) => setTimeout(monitorServerStatus, 1000))
|
||||
}
|
||||
window.onload = () => monitor_server_status();
|
||||
window.onload = () => monitorServerStatus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -318,12 +318,12 @@ function monitor_server_status() {
|
||||
document.close();
|
||||
}
|
||||
|
||||
function restart_reload() {
|
||||
function restartReload() {
|
||||
document.body.style = 'background: #222222; font-size: 1rem; font-family:monospace; margin-top:20%; color:lightgray; text-align:center';
|
||||
document.body.innerHTML = '<h1>Server shutdown in progress...</h1>';
|
||||
fetch('/sdapi/v1/progress')
|
||||
.then((res) => setTimeout(restart_reload, 1000))
|
||||
.catch((e) => setTimeout(monitor_server_status, 500));
|
||||
.then((res) => setTimeout(restartReload, 1000))
|
||||
.catch((e) => setTimeout(monitorServerStatus, 500));
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -351,6 +351,12 @@ function selectVAE(name) {
|
||||
log(`Change VAE: ${desiredVAEName}`);
|
||||
}
|
||||
|
||||
function selectReference(name) {
|
||||
console.log('HERE', name);
|
||||
desiredCheckpointName = name;
|
||||
gradioApp().getElementById('change_reference').click();
|
||||
}
|
||||
|
||||
function currentImg2imgSourceResolution(_a, _b, scaleBy) {
|
||||
const img = gradioApp().querySelector('#mode_img2img > div[style="display: block;"] img');
|
||||
return img ? [img.naturalWidth, img.naturalHeight, scaleBy] : [0, 0, scaleBy];
|
||||
@@ -361,7 +367,7 @@ function updateImg2imgResizeToTextAfterChangingImage() {
|
||||
return [];
|
||||
}
|
||||
|
||||
function create_theme_element() {
|
||||
function createThemeElement() {
|
||||
const el = document.createElement('img');
|
||||
el.id = 'theme-preview';
|
||||
el.className = 'theme-preview';
|
||||
@@ -393,7 +399,7 @@ function previewTheme() {
|
||||
if (theme) {
|
||||
window.open(theme.subdomain, '_blank');
|
||||
} else {
|
||||
const el = document.getElementById('theme-preview') || create_theme_element();
|
||||
const el = document.getElementById('theme-preview') || createThemeElement();
|
||||
el.style.display = el.style.display === 'block' ? 'none' : 'block';
|
||||
name = name.replace('/', '-');
|
||||
el.src = `/file=html/${name}.jpg`;
|
||||
|
||||
Reference in New Issue
Block a user