towhee.engine.factory.op

towhee.engine.factory.op(operator_src: str, tag: str = 'main', arg: List[Any] = [], kwargs: Dict[str, Any] = {})[source]

Create the supplied operator.

Entry method which takes either operator tasks or paths to python files or class in notebook. An Operator object is created with the init args(kwargs).

Parameters:
  • operator_src (str) – Operator name or python file location or class in notebook.

  • tag (str, optional) – Which tag to use for operators on hub. Defaults to ‘main’.

  • arg (List[Any], optional) – Operator args to pass in. Defaults to [].

  • kwargs (Dict[str, Any], optional) – Operator kwargs to pass in. Defaults to {}.

Returns:

The operator.

Return type:

operator