TransformersChartsAndPlotsAnalysis

Charts and plots analysis task

Subclass of Task.

Module: implementation.tasks

Default predictor

This task uses TransformersGenerativeModel by default with this configuration:

model = Pix2StructForConditionalGeneration.from_pretrained(
    "google/deplot"
)
predictor=TransformersGenerativeModel(
    TransformersModelConfig(
        model=model,
        kwargs={
            "max_new_tokens": 512
        }
    ),
    input_class=TransformersChartsAndPlotsModelInput,
    output_class=TransformersBasicOutput
)

See:

Methods and properties

Main methods and properties


__init__

Arguments:




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