Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
Reordered operations
JPPhoto8f4ab2b2f420
diff --git a/invokeai/app/invocations/logic.py b/invokeai/app/invocations/logic.pyindex 43deda5d42..e395551036 100644--- a/invokeai/app/invocations/logic.py+++ b/invokeai/app/invocations/logic.py@@ -42,7 +42,7 @@ class IfInvocation(BaseInvocation):return IfInvocationOutput(value=self.true_input if self.condition else self.false_input)-BOOLEAN_OPERATIONS = Literal["AND", "OR", "XOR", "NOT", "NAND", "NOR", "XNOR"]+BOOLEAN_OPERATIONS = Literal["AND", "OR", "XOR", "NAND", "NOR", "XNOR", "NOT"]@invocation("boolean_logic", title="Boolean Logic", tags=["logic", "boolean"], category="math", version="1.0.0")@@ -56,10 +56,10 @@ class BooleanLogicInvocation(BaseInvocation):"AND": "A AND B","OR": "A OR B","XOR": "A XOR B",- "NOT": "NOT A","NAND": "A NAND B","NOR": "A NOR B","XNOR": "A XNOR B",+ "NOT": "NOT A",},)a: bool = InputField(default=False, description="First Boolean input")@@ -72,12 +72,12 @@ class BooleanLogicInvocation(BaseInvocation):result = self.a or self.belif self.operation == "XOR":result = self.a != self.b- elif self.operation == "NOT":- result = not self.aelif self.operation == "NAND":result = not (self.a and self.b)elif self.operation == "NOR":result = not (self.a or self.b)- else: # self.operation == "XNOR"+ elif self.operation == "XNOR":result = self.a == self.b+ else: # self.operation == "NOT":+ result = not self.areturn BooleanOutput(value=result)diff --git a/tests/app/invocations/test_boolean_logic.py b/tests/app/invocations/test_boolean_logic.pyindex 26b9ad9446..ae449f84a7 100644--- a/tests/app/invocations/test_boolean_logic.py+++ b/tests/app/invocations/test_boolean_logic.py@@ -7,18 +7,18 @@ from invokeai.app.invocations.logic import BooleanLogicInvocationfrom invokeai.app.invocations.primitives import BooleanOutput[email protected]("operation", ["AND", "OR", "XOR", "NOT", "NAND", "NOR", "XNOR"])[email protected]("operation", ["AND", "OR", "XOR", "NAND", "NOR", "XNOR", "NOT"])@pytest.mark.parametrize("a", [False, True])@pytest.mark.parametrize("b", [False, True])-def test_boolean_logic(operation: Literal["AND", "OR", "XOR", "NOT", "NAND", "NOR", "XNOR"], a: bool, b: bool) -> None:+def test_boolean_logic(operation: Literal["AND", "OR", "XOR", "NAND", "NOR", "XNOR", "NOT"], a: bool, b: bool) -> None:expected = {"AND": a and b,"OR": a or b,"XOR": a != b,- "NOT": not a,"NAND": not (a and b),"NOR": not (a or b),"XNOR": a == b,+ "NOT": not a,}[operation]output = BooleanLogicInvocation(id="boolean_logic", operation=operation, a=a, b=b).invoke(MagicMock())