Petrol Receipt V1
Sample Code:
from mindee import Client, PredictResponse, product
# Init a new client
mindee_client = Client(api_key="my-api-key")
# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
# Load a file from disk and parse it.
# The endpoint name must be specified since it cannot be determined from the class.
result: PredictResponse = mindee_client.parse(product.fr.PetrolReceiptV1, input_doc)
# Print a brief summary of the parsed data
print(result.document)
# # Iterate over all the fields in the document
# for field_name, field_values in result.document.inference.prediction.fields.items():
# print(field_name, "=", field_values)
- class PetrolReceiptV1(raw_prediction)
Inference prediction for Petrol Receipt, API version 1.
- 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] = 'petrol_receipts'
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
[PetrolReceiptV1Document
]] Page-level prediction(s).
-
prediction:
PetrolReceiptV1Document
Document-level prediction.
- product: Product
Name and version of a given product, as sent back by the API.
- class PetrolReceiptV1Document(raw_prediction, page_id=None)
Document data for Petrol Receipt, API version 1.
- Parameters:
raw_prediction (Dict[str, Any]) –
page_id (Optional[int]) –
-
fuel:
PetrolReceiptV1Fuel
The fuel type.
-
price:
AmountField
The price per unit of fuel.
-
total:
PetrolReceiptV1Total
The total amount paid.
-
volume:
AmountField
The volume of fuel purchased.
- class PetrolReceiptV1Fuel(raw_prediction, page_id=None)
The fuel type.
- 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.
-
category:
Optional
[str
] The fuel category among a list of 4 possible choices.
- 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.
-
raw_text:
Optional
[str
] As seen on the receipt.
- class PetrolReceiptV1Total(raw_prediction, page_id=None)
The total amount paid.
- 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.
- 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.