TransformersChartsAndPlotsAnalysis
Charts and plots analysis task
Subclass of Task.
Module: implementation.tasks
Default predictor
This task uses TransformersGenerativeModel by default with this configuration:
See:
Methods and properties
Main methods and properties
__init__
Arguments:
predictor (Predictor[Any, Any], optional): Predictor that will be used in task. If equals to None, default predictor will be used. Defaults to None.
preprocess (Optional[Component], optional): Component executed before predictor. If equals to None, default component will be used. Defaults to None. Default component: ChartsAndPlotsAnalysisPreprocessor If default chain is used, ChartsAndPlotsAnalysisPreprocessor will use Pix2StructProcessor from model used in predictor.
postprocess (Optional[Component], optional): Component executed after predictor. If equals to None, default component will be used. Defaults to None. Default component: ChartsAndPlotsAnalysisPostprocessor If default chain is used, ChartsAndPlotsAnalysisPostprocessor will use Pix2StructProcessor from model used in predictor.
input_class (Type[Input], optional): Class for input validation. Defaults to ChartsAndPlotsAnalysisInput.
output_class (Type[Output], optional): Class for output validation. Defaults to TransformersBasicOutput.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
ChartsAndPlotsAnalysisInput
Subclass of IOModel.
__init__
Arguments:
image (Image.Image): Image to analyze.
text (str): Text prompt.
ChartsAndPlotsAnalysisPreprocessor
Prepare model input. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].
__init__
Arguments:
processor (Processor): Feature extractor.
execute
Arguments:
input_data (Dict[str, Any]): Expected keys:
"text" (str): Text prompt;
"image" (Image.Image): Image to analyze;
Returns:
Dict[str, Any]: Expected keys:
"flattened_patches" (Any);
"attention_mask" (Any);
ChartsAndPlotsAnalysisPostprocessor
Process model output. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].
__init__
Arguments:
processor (Processor): Feature extractor.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
execute
Arguments:
input_data (Dict[str, Any]): Expected keys:
"output" (Any): Model output;
Returns:
Dict[str, Any]: Expected keys:
"output" (str): Text representation of chart or plot;
Last updated