refactor: Remove custom dimensions from video inference, simplify dimension logic

Add Pruna Image Edit workflow
This commit is contained in:
Sirshendu Ganguly
2025-11-24 21:07:15 -05:00
parent 55fd7e4e00
commit e7b04341d9
15 changed files with 38 additions and 212 deletions
+2 -35
View File
@@ -21,26 +21,6 @@ class txt2vid:
"default": "Disabled",
"tooltip": "Prompt weighting allows you to adjust how strongly different parts of your prompt influence the generated video.\n\nChoose between \"compel\" notation with advanced weighting operations or \"sdEmbeds\" for simple emphasis adjustments.\n\nCompel Example: \"small+ dog, pixar style\"\n\nsdEmbeds Example: \"(small:2.5) dog, pixar style\"",
}),
"useCustomDimensions": ("BOOLEAN", {
"tooltip": "Model Default: Uses optimal dimensions for selected model. Custom: Uses width/height values below.",
"default": False,
"label_on": "Custom",
"label_off": "Model Default",
}),
"width": ("INT", {
"tooltip": "Width in pixels. Only used when 'Custom' is selected above.",
"default": 1024,
"min": 256,
"max": 1920,
"step": 1,
}),
"height": ("INT", {
"tooltip": "Height in pixels. Only used when 'Custom' is selected above.",
"default": 576,
"min": 256,
"max": 1920,
"step": 1,
}),
"useDuration": ("BOOLEAN", {
"tooltip": "Enable to include duration parameter in API request. Disable if your model doesn't support duration.",
"default": True,
@@ -178,9 +158,6 @@ class txt2vid:
safetyInputs = kwargs.get("safetyInputs", None)
videoAdvancedFeatureInputs = kwargs.get("videoAdvancedFeatureInputs", None)
runwareAccelerator = kwargs.get("Accelerator", None)
useCustomDimensions = kwargs.get("useCustomDimensions", False)
customWidth = kwargs.get("width", None)
customHeight = kwargs.get("height", None)
useDuration = kwargs.get("useDuration", True)
duration = kwargs.get("duration", 5)
fps = kwargs.get("fps", 24)
@@ -196,20 +173,10 @@ class txt2vid:
# Handle model input - could be dict or string
if isinstance(runwareVideoModel, dict):
model = runwareVideoModel.get("model", "")
model_use_resolution = runwareVideoModel.get("useResolution", True)
width = runwareVideoModel.get("width")
height = runwareVideoModel.get("height")
else:
model = runwareVideoModel
model_use_resolution = True
# Determine dimensions based on custom setting and model defaults
if useCustomDimensions:
width = customWidth
height = customHeight
elif model_use_resolution:
modelDimensions = videoModelSearch.MODEL_DIMENSIONS.get(model, {"width": 1024, "height": 576})
width = modelDimensions.get("width", None)
height = modelDimensions.get("height", None)
else:
width = None
height = None
+15 -13
View File
@@ -196,11 +196,11 @@ class videoModelSearch:
"label_on": "Enabled",
"label_off": "Disabled",
}),
"useResolution": ("BOOLEAN", {
"tooltip": "Enable to automatically use the model's recommended resolution. Disable to output 0x0 and set custom resolution downstream.",
"default": True,
"label_on": "Enabled",
"label_off": "Disabled",
"useCustomDimensions": ("BOOLEAN", {
"tooltip": "Enable to use custom Width/Height values set below. Disable to automatically use the model's recommended resolution.",
"default": False,
"label_on": "Custom",
"label_off": "Model Default",
}),
"Width": ("INT", {
"default": defaultDims["width"],
@@ -243,7 +243,7 @@ class videoModelSearch:
searchInput = kwargs.get("Model Search")
customWidth = kwargs.get("Width", 0)
customHeight = kwargs.get("Height", 0)
useResolution = kwargs.get("useResolution", True)
useCustomDimensions = kwargs.get("useCustomDimensions", True)
if enableSearchValue:
modelAirCode = searchInput
@@ -253,16 +253,18 @@ class videoModelSearch:
dimensions = self.MODEL_DIMENSIONS.get(modelAirCode, self.DEFAULT_DIMENSIONS)
if useResolution:
if useCustomDimensions:
# Use custom dimensions from Width/Height widgets
width = customWidth
height = customHeight
else:
# Use model default dimensions
width = dimensions["width"]
height = dimensions["height"]
else:
width = None
height = None
return ({
"model": modelAirCode,
"useResolution": useResolution,
"useResolution": useResolution,
"useCustomDimensions": useCustomDimensions,
"width": width,
"height": height,
}, width, height)