# Tensorleap Integration

This page outlines the different elements of the tensorleap integration and reviews the integration flow and development cycle within the platform.

### Prerequisites

* [Access to Tensorleap](https://docs.tensorleap.ai/getting-started/tensorleap-setup/installation#accessing-the-tensorleap-platform)&#x20;
* Leap CLI is [installed](https://docs.tensorleap.ai/getting-started/tensorleap-setup/installation#tensorleap-cli-installation) and [authenticated](https://docs.tensorleap.ai/getting-started/tensorleap-setup/cli-authentication)
* .onnx or .h5 model
* [A valid code integration](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code) that instructs Tensorleap on how to load the dataset and parse and visualize different elements.&#x20;
* Tensoleap [configuration yamls](https://docs.tensorleap.ai/tensorleap-integration/configurations-files):
  * A [leap.yaml](https://docs.tensorleap.ai/tensorleap-integration/leap.yaml) file that contains the setup of your integration.
  * (optionally) requirements.txt file if non-default requirements are needed
* An [integration test](https://docs.tensorleap.ai/tensorleap-integration/integration-test) script that instructs Tensorleap on what code needs to be run during model analysis (loss, metrics, visualizers & metadata)

### Expected Folder Structure

The expected file structure for a Tensorleap code integration is the following:

```
my_leap_project/
├── ...
├── leap_binder.py
├── leap.yaml
├── integration_test.py
```

Here, leap\_binder.py contains the [integration script](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code).

### The Tensorleap integration flow&#x20;

1. Start from an existing repo from our [Leap Hub](https://docs.tensorleap.ai/getting-started/quickstart/quickstart-using-leap-hub) or use the CLI to add template Tensorleap integration files into your existing repository.
2. Make sure your data is accessible by the [Tensorleap Server](https://docs.tensorleap.ai/getting-started/tensorleap-setup/installation#tensorleap-server).
3. Create a basic [Integration script](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code). This can include an [input\_encoder](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/input-encoder), [GT encoder](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/ground-truth-encoder), [loss](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-loss-function), and a basic [visualizer](https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/visualizer-function) for the input, prediction and GT.
4. Verify your integration validity locally using an [Integration test](https://docs.tensorleap.ai/tensorleap-integration/integration-test).
5. Use the [CLI](https://docs.tensorleap.ai/tensorleap-integration/uploading-with-cli/cli-assets-upload) to push the code and models to the platform&#x20;
6. Use the Platform to [Evaluate](https://docs.tensorleap.ai/user-interface/project/menu-bar/evaluate-a-model) and process the data using your model.

{% hint style="info" %}
After the integration step the model and dataset can be analyzed using the platform. Usually, during the analysis phase the insights and analysis being done points to a missing metadata, better visualization method, or a new metric. These elements should then be added to the integration script and then steps 4-7 are repeated.
{% endhint %}
