added lower bound to empty latent

This commit is contained in:
David Chatel
2025-02-23 19:13:16 +01:00
parent 4815e7a2ac
commit 7b898b6807
2 changed files with 3 additions and 21 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ from glob import glob
import torch
from torchvision.transforms import InterpolationMode
import torchvision.transforms.v2.functional as F
from llama_cpp_cuda import Llama
from llama_cpp import Llama
from scipy import ndimage
import numpy as np
import node_helpers
+2 -20
View File
@@ -23,7 +23,6 @@ app.registerExtension({
const body = new FormData();
body.append("image", file);
// if (pasted) body.append("subfolder", "pasted");
const resp = await api.fetchApi("/upload/image", {
method: "POST",
body
@@ -48,7 +47,7 @@ app.registerExtension({
for (let i = 0; i < x.length; i++) {
for (let j = 0; j < y.length; j++) {
if (x[i] / y[j] === ratio && Math.round(lastX / x[i] * 100) / 100 === lastX / x[i]) {
if (x[i] >= 256 && y[j] >= 256 && x[i] / y[j] === ratio && Math.round(lastX / x[i] * 100) / 100 === lastX / x[i]) {
options.push(`${x[i]}x${y[j]}: ${lastX / x[i]}`);
}
}
@@ -57,24 +56,7 @@ app.registerExtension({
}
const update = function (node, option_value = null) {
const width = node.widgets.find(w => w.name == "width").value;
const height = node.widgets.find(w => w.name == "height").value;
const x = Array.from({ length: (width + 1) / 8 + 1 }, (_, i) => i * 8);
const y = Array.from({ length: (height + 1) / 8 + 1 }, (_, i) => i * 8);
const lastX = x[x.length - 1];
const lastY = y[y.length - 1];
const ratio = lastX / lastY;
const options = [];
for (let i = 0; i < x.length; i++) {
for (let j = 0; j < y.length; j++) {
if (x[i] / y[j] === ratio && Math.round(lastX / x[i] * 100) / 100 === lastX / x[i]) {
options.push(`${x[i]}x${y[j]}: ${lastX / x[i]}`);
}
}
}
const options = getOptions(node);
const option = node.widgets.find(w => w.name == 'option')
option.options = { values: options };