-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask.py
48 lines (33 loc) · 1.24 KB
/
task.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Importing required packages
import veryfi
import pprint
# +
# Choosing a file
invoice_filename = "Input\invoice2.jpg"
# -
def veryfiOCR(filename: str):
# authentication for Veryfi OCR API
#below details can be found in Keys section in Veryfi account
client_id = 'Client_id'
client_secret = 'client_secret'
username = 'username'
api_key = 'api_key'
client = veryfi.Client(client_id, client_secret, username, api_key)
# categories = ['Contractors', 'Utilities', 'Travel']
# response = client.process_document(filename,categories=categories)
response = client.process_document(filename)
print(type(response))
return response
if __name__ == "__main__":
# Passing filepath as an argument
veryfi_response=veryfiOCR(invoice_filename)
# Printing few data from invoice
print("=================")
print("Vendor name:"+veryfi_response["vendor"]["name"])
print("tax:"+str(veryfi_response["tax"]))
print("subtotal:"+str(veryfi_response["subtotal"]))
print("total:"+str(veryfi_response["total"]))
print("=================")
print("All extracted values")
# Prints entire response dictionary using prettyPrint
pprint.pprint(veryfi_response)