-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdefault.txt
More file actions
50 lines (39 loc) · 1.38 KB
/
default.txt
File metadata and controls
50 lines (39 loc) · 1.38 KB
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
49
50
import com.mindee.input.LocalInputSource;
import com.mindee.v1.MindeeClient;
import com.mindee.v1.parsing.common.PredictResponse;
import com.mindee.v1.product.generated.GeneratedV1;
import com.mindee.v1.http.Endpoint;
import java.io.File;
import java.io.IOException;
public class SimpleMindeeClientV1 {
public static void main(String[] args) throws IOException {
String apiKey = "my-api-key";
String filePath = "/path/to/the/file.ext";
// Init a new client
var mindeeClient = new MindeeClient(apiKey);
// Load a file from disk
var inputSource = new LocalInputSource(new File(filePath));
// Configure the endpoint
Endpoint endpoint = new Endpoint(
"my-endpoint",
"my-account",
"my-version"
);
// Parse the file
PredictResponse<GeneratedV1> response = mindeeClient.parse(
GeneratedV1.class,
endpoint,
inputSource
);
// Print a summary of the response
System.out.println(response.toString());
// Print a summary of the predictions
// System.out.println(response.getDocument().toString());
// Print the document-level predictions
// System.out.println(response.getDocument().getInference().getPrediction().toString());
// Print the page-level predictions
// response.getDocument().getInference().getPages().forEach(
// page -> System.out.println(page.toString())
// );
}
}