> For the complete documentation index, see [llms.txt](https://docs.mindee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindee.com/v2/fr/modeles-crop/sdk-integration/crop-quick-start.md).

# Démarrage rapide Crop

Intégrez un modèle Crop.

## Installez la bibliothèque cliente

Installez le Mindee SDK pour le langage ou le framework de votre choix

{% tabs %}
{% tab title="Python" %}
Python ≥ 3.10 est requis. Python ≥ 3.12 est recommandé.

Installez simplement le [package PyPI](https://pypi.org/project/mindee/) avec `pip`:

```sh
pip install -U mindee~=5.5
```

{% endtab %}

{% tab title="Node.js" %}
Node.js ≥ 20.1 est requis. Node.js ≥ 22 est recommandé.

Installez simplement le [package NPM](https://www.npmjs.com/package/mindee):

```sh
npm install mindee@^5.11
```

{% endtab %}

{% tab title="PHP" %}
PHP ≥ 8.1 est requis. PHP ≥ 8.3 est recommandé.

Installez simplement le [package Packagist](https://packagist.org/packages/mindee/mindee) avec [composer](https://getcomposer.org/):

```sh
php composer.phar require "mindee/mindee:>=3.4"
```

{% endtab %}

{% tab title="Ruby" %}
Ruby ≥ 3.2 est requis.

Installez simplement le [gem](https://rubygems.org/gems/mindee) avec :

```shell
gem install mindee -v '~> 5.6'
```

{% endtab %}

{% tab title="Java" %}
Java ≥ 11 est requis. Java ≥ 17 est recommandé.

ID de groupe : `com.mindee.sdk`\
ID de l’artefact : `mindee-api-java`\
Version : `5.7.1` ou une version ultérieure

Il existe différentes méthodes d’installation : Maven, Gradle, etc. :

[Détails de l’installation](https://central.sonatype.com/artifact/com.mindee.sdk/mindee-api-java)
{% endtab %}

{% tab title=".NET" %}
.NET ≥ 8.0 est recommandé.

Installez simplement le [package NuGet](https://www.nuget.org/packages/Mindee) avec `dotnet add`:

```sh
dotnet add package Mindee --version 4.9
```

{% endtab %}
{% endtabs %}

Votre langage ou framework préféré n’est pas pris en charge ? [Demandez l’ajout d’une fonctionnalité !](https://feedback.mindee.com/?b=682f69c9e2404756e7e68d1c)

## Envoyer un fichier et interroger les résultats

Utilisez la bibliothèque cliente pour envoyer le fichier à votre modèle Crop et renvoyer le résultat.

{% tabs %}
{% tab title="Python" %}
Nécessite Python ≥ 3.10. Python ≥ 3.12 est recommandé.\
Nécessite la version [du SDK Python Mindee](https://pypi.org/project/mindee/) version **5.5.0** ou ultérieure.

{% code lineNumbers="true" %}

```python
from mindee import PathInput
from mindee.v2 import (
    Client,
    CropParameters,
    CropResponse,
)

input_path = "/path/to/the/file.ext"
api_key = "MY_API_KEY"
model_id = "MY_MODEL_ID"

# Initialiser un nouveau client
mindee_client = Client(api_key)

# Définir les paramètres de Crop
model_params = CropParameters(
    # ID du modèle, obligatoire.
    model_id=model_id,
)

# Charger un fichier depuis le disque
input_source = PathInput(input_path)

# Envoyer pour traitement avec interrogation périodique
response = mindee_client.enqueue_and_get_result(
    CropResponse,
    input_source,
    model_params,
)

# Afficher un bref résumé des données analysées
print(response.inference)

# Accéder au résultat du recadrage
crops: list = response.inference.result.crops
```

{% endcode %}

Consultez également la [Résultat du recadrage](https://docs.mindee.com/crop-models/sdk-integration/crop-result) documentation.
{% endtab %}

{% tab title="Node.js" %}
Nécessite Node.js ≥ 20.1. Node.js ≥ 22 est recommandé.\
Nécessite le [Mindee Node.js SDK](https://www.npmjs.com/package/mindee/) version **5.11.1** ou supérieure.

{% code lineNumbers="true" %}

```javascript
// ESM ou TypeScript (recommandé)
import * as mindee from "mindee";

// Si vous utilisez CommonJS :
// const mindee = require("mindee");

const apiKey = "MY_API_KEY";
const modelId = "MY_MODEL_ID";
const filePath = "/path/to/the/file.ext";

// Initialisez un nouveau client
const mindeeClient = new mindee.Client(
  { apiKey: apiKey }
);

// Définir les paramètres de Crop
const modelParams = {
  modelId: modelId,
};

// Chargez un fichier depuis le disque
const inputSource = new mindee.PathInput({ inputPath: filePath });

// Envoyez pour traitement
const response = await mindeeClient.enqueueAndGetResult(
  mindee.product.Crop,
  inputSource,
  modelParams,
);

// affichez un résumé sous forme de chaîne
console.log(response.inference.toString());

// Accédez aux découpes du résultat
const crops = response.inference.result.crops;
```

{% endcode %}

Consultez également [Résultat de Crop](https://docs.mindee.com/crop-models/sdk-integration/crop-result) documentation.
{% endtab %}

{% tab title="PHP" %}
Nécessite PHP ≥ 8.1. PHP ≥ 8.3 est recommandé.\
Nécessite le [Mindee PHP SDK](https://packagist.org/packages/mindee/mindee) version **3.4.0** ou supérieure.

{% code lineNumbers="true" %}

```php
<?php

use Mindee\Input\PathInput;
use Mindee\V2\Client;
use Mindee\V2\Product\Crop\Params\CropParameters;
use Mindee\V2\Product\Crop\CropResponse;

$apiKey = "MY_API_KEY";
$modelId = "MY_MODEL_ID";
$filePath = "/path/to/the/file.ext";

// Initialisez un nouveau client
$mindeeClient = new Client($apiKey);

// Définir les paramètres de Crop
$modelParams = new CropParameters(
    // ID du modèle, requis.
    $modelId,
);

// Chargez un fichier depuis le disque
$inputSource = new PathInput($filePath);

// Envoyer au traitement à l'aide du polling
$response = $mindeeClient->enqueueAndGetResult(
    CropResponse::class,
    $inputSource,
    $modelParams
);

// Afficher un résumé de la réponse
echo strval($response->inference);

// Accéder aux résultats de Crop
$crops = $response->inference->result->crops;
```

{% endcode %}

Consultez également [Résultat de Crop](https://docs.mindee.com/crop-models/sdk-integration/crop-result) documentation.
{% endtab %}

{% tab title="Ruby" %}
Nécessite Ruby ≥ 3.2.\
Nécessite la [Mindee Ruby SDK](https://rubygems.org/gems/mindee) version **5.6.0** ou supérieure.

{% code lineNumbers="true" %}

```ruby
require 'mindee'
require 'mindee/v2/product'

input_path = '/path/to/the/file.ext'
api_key = 'MY_API_KEY'
model_id = 'MY_MODEL_ID'

# Initialiser un nouveau client
mindee_client = Mindee::V2::Client.new(api_key: api_key)

# Définir les paramètres de Crop
model_params = {
    # ID du modèle, obligatoire.
    model_id: model_id,
}

# Charger un fichier depuis le disque
input_source = Mindee::Input::Source::PathInputSource.new(input_path)

# Envoyer au traitement
response = mindee_client.enqueue_and_get_result(
    Mindee::V2::Product::Crop::Crop,
    input_source,
    model_params
)

# Accéder aux crops de résultat
puts response.inference.result.crops
```

{% endcode %}

Consultez également [Résultat de Crop](https://docs.mindee.com/crop-models/sdk-integration/crop-result) documentation.
{% endtab %}

{% tab title="Java" %}
Nécessite Java ≥ 11. Java ≥ 17 est recommandé.\
Nécessite le [Mindee Java SDK](https://central.sonatype.com/artifact/com.mindee.sdk/mindee-api-java) version **5.7.1** ou supérieure.

{% code lineNumbers="true" %}

```java
import com.mindee.input.LocalInputSource;
import com.mindee.v2.MindeeClient;
import com.mindee.v2.product.crop.CropResponse;
import com.mindee.v2.product.crop.params.CropParameters;
import java.io.IOException;

public class SimpleMindeeClientV2 {

  public static void main(String[] args)
      throws IOException, InterruptedException
  {
    String apiKey = "MY_API_KEY";
    String modelId = "MY_MODEL_ID";
    String filePath = "/path/to/the/file.ext";

    // Initialisez un nouveau client
    var mindeeClient = new MindeeClient(apiKey);

    // Définir les paramètres de Crop
    var modelParams = CropParameters
        // ID du modèle, requis.
        .builder(modelId)
        .build();

    // Chargez un fichier depuis le disque
    var inputSource = new LocalInputSource(filePath);

    // Envoyer au traitement à l'aide du polling
    CropResponse response = mindeeClient.enqueueAndGetResult(
        CropResponse.class,
        inputSource,
        modelParams
    );

    // Afficher un résumé de la réponse
    System.out.println(response.getInference().toString());

    // Accéder aux résultats de Crop
    var crops = response.getInference().getResult().getCrops();
  }
}
```

{% endcode %}

Consultez également [Résultat de Crop](https://docs.mindee.com/crop-models/sdk-integration/crop-result) documentation.
{% endtab %}

{% tab title=".NET" %}
.NET ≥ 8.0 est recommandé.\
Nécessite le [SDK .NET de Mindee](https://www.nuget.org/packages/Mindee) version **4.9.0** ou supérieure.

{% code lineNumbers="true" %}

```csharp
using Mindee;
using Mindee.Input;
using Mindee.V2;
using Mindee.V2.Product.Crop;
using Mindee.V2.Product.Crop.Params;

string filePath = "/path/to/the/file.ext";
string apiKey = "MY_API_KEY";
string modelId = "MY_MODEL_ID";

// Construisez un nouveau client
Client mindeeClient = new Client(apiKey);

// Définissez les paramètres de Crop
var modelParams = new CropParameters(
    modelId: modelId
);

// Chargez un fichier depuis le disque
var inputSource = new LocalInputSource(filePath);

// Téléversez le fichier
var response = await mindeeClient.EnqueueAndGetResultAsync<CropResponse>(
    inputSource, modelParams);

// Affichez un résumé de la réponse
System.Console.WriteLine(response.Inference.ToString());

// Accédez aux résultats de Crop
var crops = response.Inference.Result.Crops;
```

{% endcode %}

Consultez également la [résultat Crop](https://docs.mindee.com/crop-models/sdk-integration/crop-result) documentation.
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mindee.com/v2/fr/modeles-crop/sdk-integration/crop-quick-start.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
