- Split flat node modules into categorized subpackages (tagging, detect, edge, pose, segment, restore, compare, judge, transform, utility) - Extract shared internals into _shared/ (bases, tensor, formatting) - Centralize node registration via register_nodes() helper - Clean up: remove dead is_scored return, unnecessary hasattr guard, inline imports
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""Score versus threshold boolean gate for workflow branching."""
|
|
|
|
from comfy_api.latest import io
|
|
|
|
|
|
class ImgUtilsScoreThreshold(io.ComfyNode):
|
|
"""Compare a float score against a threshold, output True if score >= threshold."""
|
|
|
|
@classmethod
|
|
def define_schema(cls) -> io.Schema:
|
|
return io.Schema(
|
|
node_id="ImgUtilsScoreThreshold",
|
|
display_name="Imgutils Score Threshold",
|
|
category="imgutils/utility",
|
|
description=(
|
|
"Compare a score against a threshold value. "
|
|
"Outputs True if score >= threshold. Useful for gating workflows."
|
|
),
|
|
search_aliases=["threshold", "score", "boolean", "gate", "compare", "filter"],
|
|
inputs=[
|
|
io.Float.Input("score", default=0.5, min=0.0, max=1.0, step=0.01, tooltip="Score value to evaluate."),
|
|
io.Float.Input("threshold", default=0.5, min=0.0, max=1.0, step=0.01, tooltip="Threshold to compare against."),
|
|
],
|
|
outputs=[
|
|
io.Boolean.Output(display_name="boolean"),
|
|
],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, score, threshold) -> io.NodeOutput:
|
|
return io.NodeOutput(score >= threshold)
|