Nutrition Facts Label V1

Sample Code:

class NutritionFactsLabelV1(raw_prediction)

Nutrition Facts Label API version 1 inference prediction.

static get_endpoint_info(klass)

Retrives the endpoint information for an Inference.

Should never retrieve info for CustomV1, as a custom endpoint should be created to use CustomV1.

Parameters:

klass (Type[Inference]) – product subclass to access endpoint information.

Return type:

Dict[str, str]

endpoint_name: Optional[str] = 'nutrition_facts'

Name of the endpoint.

endpoint_version: Optional[str] = '1'

Version of the endpoint.

is_rotation_applied: Optional[bool]

Whether the document has had any rotation applied to it.

page_id: Optional[int]

Optional page id for page-level predictions.

pages: List[Page[NutritionFactsLabelV1Document]]

Page-level prediction(s).

prediction: NutritionFactsLabelV1Document

Document-level prediction.

product: Product

Name and version of a given product, as sent back by the API.

class NutritionFactsLabelV1Document(raw_prediction, page_id=None)

Nutrition Facts Label API version 1.0 document data.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

added_sugars: NutritionFactsLabelV1AddedSugar

The amount of added sugars in the product.

calories: NutritionFactsLabelV1Calorie

The amount of calories in the product.

cholesterol: NutritionFactsLabelV1Cholesterol

The amount of cholesterol in the product.

dietary_fiber: NutritionFactsLabelV1DietaryFiber

The amount of dietary fiber in the product.

nutrients: List[NutritionFactsLabelV1Nutrient]

The amount of nutrients in the product.

protein: NutritionFactsLabelV1Protein

The amount of protein in the product.

saturated_fat: NutritionFactsLabelV1SaturatedFat

The amount of saturated fat in the product.

serving_per_box: AmountField

The number of servings in each box of the product.

serving_size: NutritionFactsLabelV1ServingSize

The size of a single serving of the product.

sodium: NutritionFactsLabelV1Sodium

The amount of sodium in the product.

total_carbohydrate: NutritionFactsLabelV1TotalCarbohydrate

The total amount of carbohydrates in the product.

total_fat: NutritionFactsLabelV1TotalFat

The total amount of fat in the product.

total_sugars: NutritionFactsLabelV1TotalSugar

The total amount of sugars in the product.

trans_fat: NutritionFactsLabelV1TransFat

The amount of trans fat in the product.

class NutritionFactsLabelV1ServingSize(raw_prediction, page_id=None)

The size of a single serving of the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

amount: Optional[float]

The amount of a single serving.

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

page_n: int

The document page on which the information was found.

polygon: Polygon

A polygon containing the word in the document.

unit: Optional[str]

The unit for the amount of a single serving.

class NutritionFactsLabelV1Calorie(raw_prediction, page_id=None)

The amount of calories in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of calories to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of calories per 100g of the product.

per_serving: Optional[float]

The amount of calories per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1TotalFat(raw_prediction, page_id=None)

The total amount of fat in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of total fat to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of total fat per 100g of the product.

per_serving: Optional[float]

The amount of total fat per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1SaturatedFat(raw_prediction, page_id=None)

The amount of saturated fat in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of saturated fat to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of saturated fat per 100g of the product.

per_serving: Optional[float]

The amount of saturated fat per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1TransFat(raw_prediction, page_id=None)

The amount of trans fat in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of trans fat to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of trans fat per 100g of the product.

per_serving: Optional[float]

The amount of trans fat per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1Cholesterol(raw_prediction, page_id=None)

The amount of cholesterol in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of cholesterol to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of cholesterol per 100g of the product.

per_serving: Optional[float]

The amount of cholesterol per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1TotalCarbohydrate(raw_prediction, page_id=None)

The total amount of carbohydrates in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of total carbohydrates to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of total carbohydrates per 100g of the product.

per_serving: Optional[float]

The amount of total carbohydrates per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1DietaryFiber(raw_prediction, page_id=None)

The amount of dietary fiber in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of dietary fiber to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of dietary fiber per 100g of the product.

per_serving: Optional[float]

The amount of dietary fiber per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1TotalSugar(raw_prediction, page_id=None)

The total amount of sugars in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of total sugars to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of total sugars per 100g of the product.

per_serving: Optional[float]

The amount of total sugars per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1AddedSugar(raw_prediction, page_id=None)

The amount of added sugars in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of added sugars to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of added sugars per 100g of the product.

per_serving: Optional[float]

The amount of added sugars per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1Protein(raw_prediction, page_id=None)

The amount of protein in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of protein to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of protein per 100g of the product.

per_serving: Optional[float]

The amount of protein per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

class NutritionFactsLabelV1Sodium(raw_prediction, page_id=None)

The amount of sodium in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_field_list()

Output the object in a format suitable for inclusion in an rST field list.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of sodium to consume or not to exceed each day.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of sodium per 100g of the product.

per_serving: Optional[float]

The amount of sodium per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

unit: Optional[str]

The unit of measurement for the amount of sodium.

class NutritionFactsLabelV1Nutrient(raw_prediction, page_id=None)

The amount of nutrients in the product.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

to_table_line()

Output in a format suitable for inclusion in an rST table.

Return type:

str

bounding_box: Optional[Quadrilateral]

A right rectangle containing the word in the document.

confidence: float

The confidence score.

daily_value: Optional[float]

DVs are the recommended amounts of nutrients to consume or not to exceed each day.

name: Optional[str]

The name of nutrients of the product.

page_n: int

The document page on which the information was found.

per_100g: Optional[float]

The amount of nutrients per 100g of the product.

per_serving: Optional[float]

The amount of nutrients per serving of the product.

polygon: Polygon

A polygon containing the word in the document.

unit: Optional[str]

The unit of measurement for the amount of nutrients.