# TransformersChartsAndPlotsAnalysis

Subclass of [**Task**](/tasks/task.md)**.**&#x20;

## Module: [implementation](/framework-structure.md#implementation).tasks

## Default predictor

This task uses [**TransformersGenerativeModel**](/predictors/transformers-predictors.md#transformersgenerativemodel) by default with this configuration:

{% code overflow="wrap" fullWidth="false" %}

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

{% endcode %}

#### See:

* [**TransformersGenerativeModel**](/predictors/transformers-predictors.md#transformersgenerativemodel)&#x20;
* [**TransformersModelConfig**](/predictors/transformers-predictors.md#transformersmodelconfig)
* [**TransformersChartsAndPlotsModelInput**](/predictors/transformers-schemas.md#transformerschartsandplotsmodelinput)
* [**TransformersBasicOutput**](/predictors/transformers-schemas.md#transformersbasicoutput)

## Methods and properties

Main methods and properties

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**predictor**</mark>**&#x20;(**[**Predictor**](/predictors/predictor.md)**\[Any, Any], optional):** Predictor that will be used in task. If equals to None, [**default predictor**](#default-predictor) will be used. Defaults to None.
* <mark style="color:orange;">**preprocess**</mark>**&#x20;(Optional\[**[**Component**](/core/component.md)**], optional):** Component executed before predictor. If equals to None, default component will be used. Defaults to None.\
  \
  Default component: \
  [**ChartsAndPlotsAnalysisPreprocessor**](#chartsandplotsanalysispreprocessor)\
  \
  If default chain is used, [**ChartsAndPlotsAnalysisPreprocessor**](#chartsandplotsanalysispreprocessor) will use **Pix2StructProcessor** from model used in **predictor**.
* <mark style="color:orange;">**postprocess**</mark>**&#x20;(Optional\[**[**Component**](/core/component.md)**], optional):** Component executed after predictor. If equals to None, default component will be used. Defaults to None.\
  \
  Default component: \
  [**ChartsAndPlotsAnalysisPostprocessor**](#chartsandplotsanalysispostprocessor)\
  \
  If default chain is used, [**ChartsAndPlotsAnalysisPostprocessor**](#chartsandplotsanalysispostprocessor) will use **Pix2StructProcessor** from model used in **predictor**.
* <mark style="color:orange;">**input\_class**</mark>**&#x20;(Type\[**[**Input**](/core/schemas.md#input)**], optional):** Class for input validation. Defaults to [**ChartsAndPlotsAnalysisInput**](#chartsandplotsanalysisinput)**.**
* <mark style="color:orange;">**output\_class**</mark>**&#x20;(Type\[**[**Output**](/core/schemas.md#output)**], optional):** Class for output validation. Defaults to [**TransformersBasicOutput**](/predictors/transformers-schemas.md#transformersbasicoutput)**.**
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

***

***

## <mark style="color:green;">ChartsAndPlotsAnalysisInput</mark>

Subclass of [**IOModel**](/core/schemas.md#iomodel)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**image**</mark>**&#x20;(Image.Image):** Image to analyze.
* <mark style="color:orange;">**text**</mark>**&#x20;(str):** Text prompt.

***

***

***

## <mark style="color:green;">ChartsAndPlotsAnalysisPreprocessor</mark>

Prepare model input. Subclass of [**Action**](/core/action.md). Type of [**Action**](/core/action.md)**\[Dict\[str, Any], Dict\[str, Any]].**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**processor**</mark>**&#x20;(Processor):** Feature extractor.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:
  * <mark style="color:red;">**"text"**</mark>**&#x20;(str):** Text prompt;
  * <mark style="color:red;">**"image"**</mark> **(Image.Image):** Image to analyze;

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:
  * <mark style="color:red;">**"flattened\_patches"**</mark>**&#x20;(Any);**
  * <mark style="color:red;">**"attention\_mask"**</mark>**&#x20;(Any);**

***

***

***

## <mark style="color:green;">ChartsAndPlotsAnalysisPostprocessor</mark>

Process model output. Subclass of [**Action**](/core/action.md). Type of [**Action**](/core/action.md)**\[Dict\[str, Any], Dict\[str, Any]].**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**processor**</mark>**&#x20;(Processor):** Feature extractor.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:
  * <mark style="color:red;">**"output"**</mark>**&#x20;(Any):** Model output;

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:
  * <mark style="color:red;">**"output"**</mark>**&#x20;(str):** Text representation of chart or plot;

***

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://utca.knowledgator.com/tasks/transformerschartsandplotsanalysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
