.NET

Make a prediction on a document

Suppose we wish to run inference on a document using Lucidtech’s invoice model.
1
using Lucidtech.Las;
2
3
Client client = new Client(<credentials>);
4
string documentId = "las:document:39e2d47b04214610a66050d1c6ed8b6d";
5
string modelId = "las:model:39e2d47b04214610a66050d1c6ed8b6d";
6
var response = client.CreatePrediction(documentId, modelId);
Copied!

Set ground truth of document

When uploading data that will be used for training and evaluation, we need to provide a ground truth.
1
using Lucidtech.Las;
2
3
byte[] content = File.ReadAllBytes("MyReceipt.jpeg");
4
var groundTruth = new List<Dictionary<string, string>>()
5
{
6
new Dictionary<string, string>(){{"label", "total_amount"},{"value", "54.50"}},
7
new Dictionary<string, string>(){{"label", "purchase_date"},{"value", "2007-07-30"}}
8
};
9
var response = client.CreateDocument(content, "image/jpeg", groundTruth: groundTruth);
Copied!

Update an existing document

If for instance a prediction reveals incorrect values in the ground truth of a document, we can update the existing document with new ground truth values.
1
var response = client.UpdateDocument("las:document:<uuid-hex>", groundTruth: groundTruth);
Copied!
var response = client.UpdateDocument(documentId: "", groundTruth: groundTruth);

Create a document with consent id

Consent ID is an identifier you can assign to documents to keep track of document ownership for your customers.
1
using Lucidtech.Las;
2
3
Client client = new Client(<credentials>);
4
byte[] body = File.ReadAllBytes("invoice.pdf");
5
var response = client.CreateDocument(body, "application/pdf", "<consent id>");
Copied!

Revoking consent and deleting documents

Suppose we wish to delete all documents associated with a customer in our ERP database or other systems. We need to provide a consent_id to the prediction method that uniquely identifies the customer and use that consent_id to delete documents.
1
using Lucidtech.Las;
2
3
Client client = new Client(<credentials>);
4
var response = client.DeleteDocuments(consentId: "<consentId>");
Copied!
Last modified 5mo ago