diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..30424ee --- /dev/null +++ b/__init__.py @@ -0,0 +1,5 @@ +from .loader import TextLoader + + +def text_loader(*args, **kwargs): + return TextLoader(*args, **kwargs) diff --git a/loader.py b/loader.py new file mode 100644 index 0000000..4805b0e --- /dev/null +++ b/loader.py @@ -0,0 +1,16 @@ +from towhee.operator import PyOperator + + +class TextLoader(PyOperator): + """ + DefaultOperator for _input and _output nodes. + """ + + def __init__(self): + #pylint: disable=useless-super-delegation + super().__init__() + + def __call__(self, *args): + if len(args) == 1: + return args[0] + return args