Skip to content

Commit

Permalink
added item uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
ebc5802 committed May 1, 2024
1 parent 8037658 commit 0181aed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion machine-learning-client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from dotenv import load_dotenv
from bson import ObjectId
from mindee import Client, PredictResponse, product # To access mindee OCR API
import uuid

import logging

Expand Down Expand Up @@ -82,7 +83,7 @@ def pretdict_endpoint():
receipt_data = {
'receipt_name': receipt['supplier_name']['raw_value'],
'currency': receipt['locale']['currency'],
'items': [{'description': item['description'], 'amount': item['total_amount'], 'quantity': item['quantity']} for item in receipt['line_items']],
'items': [{'description': item['description'], 'amount': item['amount'], '_id': str(uuid.uuid4())} for item in receipt['items']],# generate a unique ID for each item
'total': receipt['total_amount']['value'],
'tax': receipt['total_tax']['value'],
'tip': receipt['tip']['value'],
Expand Down
3 changes: 2 additions & 1 deletion machine-learning-client/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ black
requests
Flask
python-dotenv
mindee
mindee
uuid

0 comments on commit 0181aed

Please sign in to comment.