taskflow

class Taskflow(task, model=None, device_id=0, **kwargs)[源代码]

基类:object

The Taskflow is the end2end inferface that could convert the raw text to model result, and decode the model result to task result. The main functions as follows:
  1. Convert the raw text to task result.

  2. Convert the model to the inference model.

  3. Offer the usage and help message.

参数
  • task (str) -- The task name for the Taskflow, and get the task class from the name.

  • model (str, optional) -- The model name in the task, if set None, will use the default model.

  • device_id (int, optional) -- The device id for the gpu, xpu and other devices, the defalut value is 0.

  • kwargs (dict, optional) -- Additional keyword arguments passed along to the specific task.

help()[源代码]

Return the task usage message.

static tasks()[源代码]

Return the available task list.