Making predictions
Before you can make predictions with a model it needs to be trained and active. If you want to make predictions through the CLI, cURL or with one of the SDKs, make sure that you have the modelId for the model you would like to test. The modelId can be found under Models -> Your model -> Overview.
- App
- CLI
- cURL
- Python
Go to Model testing and select the model you want to use. You can either use a document from one of your datasets or upload a document from your computer.
las models list # Pick an active model for testing
las documents create receipt.pdf
las predictions create <documentId> <modelId> # use the documentId from the previous step
curl -X POST 'https://api.lucidtech.ai/v1/documents' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJra...' \
--data-raw '{
"content": "JVBERi0xLjQ...",
"contentType": "application/pdf",
}'
curl -X POST 'https://api.lucidtech.ai/v1/predictions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJra...' \
--data-raw '{
"documentId": "<documentId>",
"modelId": "<modelId>"
}'
from pathlib import Path
client.list_models() # Pick an active model for testing
document = client.create_document(Path('document.pdf').read_bytes(), 'application/pdf')
client.create_prediction(document_id=document['documentId'], model_id='<modelId>')
The output should have a structure as shown below
{
"predictionId": "<predictionId>",
"modelId": "<modelId>",
"documentId": "<documentId>",
"predictions": [
{
"label": "total_amount",
"value": "5154.06",
"confidence": 0.9758162361908527
},
{
"label": "purchase_date",
"value": "2019-12-23",
"confidence": 0.96797316745869735
},
],
"timestamp": 1629188787,
"inferenceTime": 2.7935566902160645
}
info
See the confidence section to read more about confidence levels and how you can use them to feel confident in your model's predictions.
If you want to learn more about the basics, check out models and predictions in the Concepts section.