- Updated model selection in image-to-image, mask generation, object detection, video classification, zero-shot image classification, zero-shot object detection, document question answering, feature extraction, image-to-text, image-text-to-text, visual question answering, conversational, fill mask, question answering, sentence similarity, table question answering, zero-shot classification, text classification, text generation, and token classification pipelines to use a default string instead of a model list. - Removed unused keypoint detection, summarization, text2text generation, and translation pipelines. - Added utility nodes for type conversion: IntToString, StringToInt, FloatToString, and StringToFloat. - Updated all pipeline calls to include trust_remote_code=True for enhanced security. - Improved requirements by adding timm and opencv-python for better functionality.
86 lines
1.8 KiB
Python
86 lines
1.8 KiB
Python
class IntToString:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"value": ("INT", {"default": 0}),
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ("STRING",)
|
|
RETURN_NAMES = ("text",)
|
|
FUNCTION = "convert"
|
|
CATEGORY = "Transformers/Utility"
|
|
|
|
def convert(self, value):
|
|
return (str(value),)
|
|
|
|
|
|
class StringToInt:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"text": ("STRING", {"default": "0"}),
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ("INT",)
|
|
RETURN_NAMES = ("value",)
|
|
FUNCTION = "convert"
|
|
CATEGORY = "Transformers/Utility"
|
|
|
|
def convert(self, text):
|
|
return (int(text.strip()),)
|
|
|
|
|
|
class FloatToString:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"value": ("FLOAT", {"default": 0.0}),
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ("STRING",)
|
|
RETURN_NAMES = ("text",)
|
|
FUNCTION = "convert"
|
|
CATEGORY = "Transformers/Utility"
|
|
|
|
def convert(self, value):
|
|
return (str(value),)
|
|
|
|
|
|
class StringToFloat:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"text": ("STRING", {"default": "0.0"}),
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ("FLOAT",)
|
|
RETURN_NAMES = ("value",)
|
|
FUNCTION = "convert"
|
|
CATEGORY = "Transformers/Utility"
|
|
|
|
def convert(self, text):
|
|
return (float(text.strip()),)
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"IntToString": IntToString,
|
|
"StringToInt": StringToInt,
|
|
"FloatToString": FloatToString,
|
|
"StringToFloat": StringToFloat,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"IntToString": "Int to String",
|
|
"StringToInt": "String to Int",
|
|
"FloatToString": "Float to String",
|
|
"StringToFloat": "String to Float",
|
|
}
|