---
title: "Generate OCR-based predictions for a product."
method: GET
path: "/predict/ocr_prediction"
tags: ["Predict"]
---

# Generate OCR-based predictions for a product.

`GET /predict/ocr_prediction`

Generate OCR-based predictions for a product based on the OCR JSON obtained from Google Cloud Vision.

## Query parameters

- `ocr_url` string, uri, required
- `server_type` 'off' | 'obf' | 'opff' | 'opf' | 'off_pro'
- `prediction_types` string

## Response `200`

the extracted predictions

- object — the extracted predictions
  - `predictions` Prediction[], required — a list of extracted predictions
    - `barcode` string — barcode of the product
    - `type` string — the prediction type
    - `timestamp` string, date-time — datetime of creation of the prediction
    - `data` object — a JSON structure containing prediction data. It either complements `value` and `value_tag` with additional data or contains the full prediction data.
    - `value_tag` string — the value tag of the prediction. The use of this field depends of the prediction type, but it contains most of the time the canonical tag that should be sent to Product Opener. For example, for a category prediction, `value_tag` can be `en:beverages`.
    - `value` string, nullable — the value of the prediction. It is used if no canonical tag can be used for the prediction type. For example, we use it to store the detected product weight value (example: `100 g`)
    - `automatic_processing` boolean — a boolean indicating whether we're confident enough in the prediction to apply it automatically in Open Food Facts without human supervision. This does not mean it will indeed be applied automatically, please refer to the import mechanism description in the documentation to know how automatic processing works.
    - `source_image` string — the path of the image the prediction was generated from. May be null, it is mainly provided for OCR and object detection-based predictions.
    - `id` number — unique ID of the prediction in the PostgreSQL DB
    - `predictor_version` string — this is a version ID that is used to know when to replace predictions in database by new ones during import, and when to keep them. It is either an incrementing integer (for regex-based predictions) or the version of the model that generated the predictions.
    - `predictor` string — name of the predictor that generated the prediction. Every insight type has its own `predictor`s, but most common ones are: - `universal-logo-detector` for predictions generated by the nearest-neighbors logo detector - `flashtext` for all predictions generated using flashtext library - `regex` for all predictions generated using simple regex
    - `server_type` ServerType — unresolved $ref
    - `confidence` number — confidence score of the prediction, it is only provided for ML-based predictions. It may be null.

## Other responses

- `400` — An HTTP 400 is returned if the provided parameters are invalid

---

[API](https://skmtc.net/openfoodfacts/apis/api-reference.md) · [All operations](https://skmtc.net/openfoodfacts/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openfoodfacts/api-reference/revisions/23d26c6d55e6/schema)
