# @tensorleap\_preprocess

The `tensorleap_preprocess` decorates a [**Preprocessing Function**](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/preprocess-function)

```python
@tensorleap_preprocess()
def preprocess_func_leap() -> List[PreprocessResponse]:
    pass
```

### Examples

#### Basic Usage

```python
from code_loader.contract.datasetclasses import PreprocessResponse
from code_loader.contract.enums import DataStateType
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_preprocess

# Preprocessing Function
@tensorleap_preprocess()
def preprocessing_func() -> List[PreprocessResponse]:
    ...
    train = PreprocessResponse(length=len(train_df), data=train_df, state=DataStateType.training)
    val = PreprocessResponse(length=len(val_df), data=val_df, state=DataStateType.validation)
    test = PreprocessResponse(length=len(test_df), data=test_df, state=DataStateType.test)
    unlabeled = PreprocessResponse(length=len(test_df), data=unlabeled_df, state=DataStateType.unlabeled)

    return [train, val, test, unlabeled]
```

Usage within the full script can be found at the [**Dataset Script**](https://docs.tensorleap.ai/writing-integration-code#dataset-script).

#### Guides

Full examples can be found at the **Dataset Integration** section of the following guides:

* [**MNIST Guide**](https://docs.tensorleap.ai/guides/full-guides/mnist-guide)
* [**IMDB Guide**](https://docs.tensorleap.ai/guides/full-guides/imdb-guide)
