Added upscaleFactor to imageInference

This commit is contained in:
Sirshendu Ganguly
2026-05-25 17:30:20 +05:30
parent bfd4af1111
commit 586eb6f92f
3 changed files with 24 additions and 0 deletions
+7
View File
@@ -812,6 +812,7 @@ function useParameterToggleHandler(node) {
"useCFGScale": ["cfgScale"], // Image inference uses lowercase cfgScale
"useScheduler": ["scheduler"],
"useClipSkip": ["clipSkip"],
"useUpscaleFactor": ["upscaleFactor"],
// Video Inference
"useCustomDimensions": ["width", "height"], // Note: Also handled separately in videoInferenceDimensionsHandler
@@ -2520,6 +2521,8 @@ function imageInferenceToggleHandler(imageInferenceNode) {
const maskMarginValueWidget = imageInferenceNode.widgets.find(w => w.name === "maskMargin");
const useResolutionWidget = imageInferenceNode.widgets.find(w => w.name === "useResolution");
const resolutionWidget = imageInferenceNode.widgets.find(w => w.name === "resolution");
const useUpscaleFactorWidget = imageInferenceNode.widgets.find(w => w.name === "useUpscaleFactor");
const upscaleFactorWidget = imageInferenceNode.widgets.find(w => w.name === "upscaleFactor");
const dimensionsWidget = imageInferenceNode.widgets.find(w => w.name === "dimensions");
const widthWidget = imageInferenceNode.widgets.find(w => w.name === "width");
const heightWidget = imageInferenceNode.widgets.find(w => w.name === "height");
@@ -2600,6 +2603,10 @@ function imageInferenceToggleHandler(imageInferenceNode) {
if (useResolutionWidget && resolutionWidget) {
toggleWidgetState(useResolutionWidget, resolutionWidget, "resolution");
}
if (useUpscaleFactorWidget && upscaleFactorWidget) {
toggleWidgetState(useUpscaleFactorWidget, upscaleFactorWidget, "upscaleFactor");
}
// Handle Dimensions - disable width/height when dimensions is "None"
if (dimensionsWidget && widthWidget && heightWidget) {
+16
View File
@@ -150,6 +150,14 @@ class txt2img:
"max": 100,
"step": 1,
}),
"useUpscaleFactor": ("BOOLEAN", {
"tooltip": "Enable to include upscaleFactor parameter in API request.",
"default": False,
}),
"upscaleFactor": ([1, 2, 4], {
"tooltip": "Upscale the initially generated image by the given factor. Supported values: 1, 2, or 4.",
"default": 2,
}),
},
"optional": {
@@ -272,6 +280,8 @@ class txt2img:
acceleration = kwargs.get("acceleration", "none")
useResolution = kwargs.get("useResolution", False)
resolution = kwargs.get("resolution", "1k")
useUpscaleFactor = kwargs.get("useUpscaleFactor", False)
upscaleFactor = kwargs.get("upscaleFactor", 2)
if (maskImage is not None and seedImage is None):
raise Exception("Mask Image Requires Seed Image To Be Provided!")
@@ -335,6 +345,12 @@ class txt2img:
# Add resolution if enabled
if useResolution:
genConfig[0]["resolution"] = resolution
if useUpscaleFactor:
upscaleFactor = int(upscaleFactor)
if upscaleFactor not in (1, 2, 4):
raise ValueError("upscaleFactor must be 1, 2, or 4 when useUpscaleFactor is enabled.")
genConfig[0]["upscaleFactor"] = upscaleFactor
if (runwareLora is not None):
if (isinstance(runwareLora, list)):
File diff suppressed because one or more lines are too long