Blankse's picture
Upload folder using huggingface_hub
e5b8fac verified
import math
from ...components.fields import Field
from ...components.tree import TREE_CONVERTERS
class Int2Float:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"Value": Field.int(),
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "get_value"
CATEGORY = TREE_CONVERTERS
def get_value(self, Value):
return (float(Value),)
class CeilNode:
def __init__(self) -> None:
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"Value": Field.float(),
}
}
RETURN_TYPES = ("INT",)
FUNCTION = "get_value"
CATEGORY = TREE_CONVERTERS
def get_value(self, Value):
total = int(math.ceil(Value))
return (total,)
class FloorNode:
def __init__(self) -> None:
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"Value": Field.float(),
}
}
RETURN_TYPES = ("INT",)
FUNCTION = "get_value"
CATEGORY = TREE_CONVERTERS
def get_value(self, Value):
total = int(math.floor(Value))
return (total,)
class ABSNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"Value": Field.float(),
"negative_out": ([False, True],)
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "abs_val"
CATEGORY = TREE_CONVERTERS
def abs_val(self, Value, Get_negative):
if Get_negative:
return (-abs(Value),)
return (abs(Value),)