Predict

Predict categories for a product

Predictions are performed using a neural model. As input, you can either provide:

  • the barcode of a product: Robotoff will fetch the product from Product Opener and will use this data as inputs to predict categories.
  • expected inputs under a product key. The neural category model accepts the following fields as input: product_name, ingredients_tags, ocr, nutriments, image_embeddings. All fields are optional (but you should at least provide one).
POST
/predict/category
barcodestring

The barcode of the product to categorize

Length1 <= length
server_type?string

The server type (=project) to use, such as 'off' (Open Food Facts), 'obf' (Open Beauty Facts),... Only 'off' is currently supported for category prediction

Default"off"
Value in"off" | "obf" | "opff" | "opf"
deepest_only?boolean

If true, only return the deepest elements in the category taxonomy (don't return categories that are parents of other predicted categories)

threshold?number

The score above which we consider the category to be detected

Default0.5
productobject

product information used as model input. All fields are optional, but at least one field must be provided.

Properties1 <= properties

Response Body

curl -X POST "https://robotoff.openfoodfacts.org/api/v1/predict/category" \
  -H "Content-Type: application/json" \
  -d '{
    "barcode": "0748162621021"
  }'
{
  "neural": [
    {
      "value_tag": "en:roast-chicken",
      "confidence": 0.6
    }
  ]
}