Python SDK for Lucidtech AI Services
Project description
# Python SDK for Lucidtech AI Services API
## Installation
```bash
$ pip install lucidtech-las
```
## Usage Match Receipts
```python
from las import Client
api_key = '...'
client = Client(api_key)
transactions = {
'transaction_1': {'total': '100.00', 'date': '2017-08-21'},
'transaction_2': {'total': '340.90', 'date': '2016-03-08'},
'transaction_3': {'total': '90.37', 'date': '2017-02-17'}
}
receipts = {
'receipt_1': 'https://example.com/receipt1.jpeg',
'receipt_2': 'https://example.com/receipt2.jpeg',
'receipt_3': 'https://example.com/receipt3.jpeg',
}
matching_fields = [
'total',
'date'
]
response = client.match_receipts(
transactions=transactions,
receipts=receipts,
matching_fields=matching_fields
)
print(response['matchedTransactions'])
# {'transaction_1': 'receipt_2', 'transaction_3': 'receipt_1'}
print(response['notMatchedTransactions'])
# ['transaction_2']
```
## Usage Scan Receipt
```python
from las import Client
api_key = '...'
client = Client(api_key)
fields = client.scan_receipt(receipt_url='https://example.com/img.jpeg')
print(fields)
# [{'label': 'total', 'value': '157.00', 'confidence': '0.968395300'} ...]
with open('img.jpeg', 'rb') as fp:
fields = client.scan_receipt(receipt_fp=fp)
print(fields)
# [{'label': 'total', 'value': '157.00', 'confidence': '0.968395300'} ...]
```
## Installation
```bash
$ pip install lucidtech-las
```
## Usage Match Receipts
```python
from las import Client
api_key = '...'
client = Client(api_key)
transactions = {
'transaction_1': {'total': '100.00', 'date': '2017-08-21'},
'transaction_2': {'total': '340.90', 'date': '2016-03-08'},
'transaction_3': {'total': '90.37', 'date': '2017-02-17'}
}
receipts = {
'receipt_1': 'https://example.com/receipt1.jpeg',
'receipt_2': 'https://example.com/receipt2.jpeg',
'receipt_3': 'https://example.com/receipt3.jpeg',
}
matching_fields = [
'total',
'date'
]
response = client.match_receipts(
transactions=transactions,
receipts=receipts,
matching_fields=matching_fields
)
print(response['matchedTransactions'])
# {'transaction_1': 'receipt_2', 'transaction_3': 'receipt_1'}
print(response['notMatchedTransactions'])
# ['transaction_2']
```
## Usage Scan Receipt
```python
from las import Client
api_key = '...'
client = Client(api_key)
fields = client.scan_receipt(receipt_url='https://example.com/img.jpeg')
print(fields)
# [{'label': 'total', 'value': '157.00', 'confidence': '0.968395300'} ...]
with open('img.jpeg', 'rb') as fp:
fields = client.scan_receipt(receipt_fp=fp)
print(fields)
# [{'label': 'total', 'value': '157.00', 'confidence': '0.968395300'} ...]
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lucidtech-las-0.0.3.tar.gz
(6.7 kB
view details)
File details
Details for the file lucidtech-las-0.0.3.tar.gz
.
File metadata
- Download URL: lucidtech-las-0.0.3.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ceb1a805ad507bfa682d872937438f3414c9650b2086b7d07dfda108f1c3e1f |
|
MD5 | 1da5405496620695b485e9d024e7a968 |
|
BLAKE2b-256 | 070be809d5d8751b3a23607db905260d404798cafde2151472539aa775a5f1c8 |