towhee.Inject

class towhee.Inject(**kws)[source]

Bases: object

Build a pipeline by operator injection.

Injecting is another pipeline templating mechanism that allows the use to modify the pipeline directly without declaring template variables.

Examples: ```yaml operators: - name: operator_1

function: namespace/operator_1 <<– injection point …

  • name: operator_2 function: namespace/operator_2

```

You can modify the pipeline directly by:

>>> pipe = Inject(operator_1 = dict(function='my_namespace/my_op')).pipeline('pipeline_name')

and the value at the injection point is replace by the Inject API.

Methods

pipeline

__init__(**kws) None[source]