Skip to content

Commit d75b572

Browse files
authored
📝 slightly better code samples (#305)
1 parent d1f6769 commit d75b572

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

docs/code_samples/v2_classification.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import com.mindee.v2.product.classification.ClassificationClassifier;
44
import com.mindee.v2.product.classification.ClassificationResponse;
55
import com.mindee.v2.product.classification.ClassificationResult;
66
import com.mindee.v2.product.classification.params.ClassificationParameters;
7-
import java.io.File;
87
import java.io.IOException;
98

109
public class SimpleMindeeClientV2 {
@@ -29,7 +28,7 @@ public class SimpleMindeeClientV2 {
2928
// Load a file from disk
3029
LocalInputSource inputSource = new LocalInputSource(filePath);
3130

32-
// Send for processing
31+
// Send for processing using polling
3332
ClassificationResponse response = mindeeClient.enqueueAndGetResult(
3433
ClassificationResponse.class,
3534
inputSource,

docs/code_samples/v2_crop.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import com.mindee.input.LocalInputSource;
33
import com.mindee.v2.product.crop.CropResponse;
44
import com.mindee.v2.product.crop.CropResult;
55
import com.mindee.v2.product.crop.params.CropParameters;
6-
import java.io.File;
76
import java.io.IOException;
87

98
public class SimpleMindeeClientV2 {
@@ -19,7 +18,6 @@ public class SimpleMindeeClientV2 {
1918
MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey);
2019

2120
// Set inference parameters
22-
// Note: modelId is mandatory.
2321
CropParameters cropParams = CropParameters
2422
// ID of the model, required.
2523
.builder(modelId)
@@ -28,7 +26,7 @@ public class SimpleMindeeClientV2 {
2826
// Load a file from disk
2927
LocalInputSource inputSource = new LocalInputSource(filePath);
3028

31-
// Send for processing
29+
// Send for processing using polling
3230
CropResponse response = mindeeClient.enqueueAndGetResult(
3331
CropResponse.class,
3432
inputSource,

docs/code_samples/v2_extraction.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import com.mindee.MindeeClientV2;
22
import com.mindee.InferenceParameters;
33
import com.mindee.input.LocalInputSource;
44
import com.mindee.parsing.v2.InferenceResponse;
5-
import com.mindee.parsing.v2.InferenceResult;
5+
import com.mindee.parsing.v2.field.InferenceFields;
66
import java.io.IOException;
77

88
public class SimpleMindeeClientV2 {
@@ -18,7 +18,6 @@ public class SimpleMindeeClientV2 {
1818
MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey);
1919

2020
// Set inference parameters
21-
// Note: modelId is mandatory.
2221
InferenceParameters extractionParams = InferenceParameters
2322
// ID of the model, required.
2423
.builder(modelId)
@@ -40,7 +39,7 @@ public class SimpleMindeeClientV2 {
4039
// Load a file from disk
4140
LocalInputSource inputSource = new LocalInputSource(filePath);
4241

43-
// Send for processing
42+
// Send for processing using polling
4443
InferenceResponse response = mindeeClient.enqueueAndGetResult(
4544
InferenceResponse.class,
4645
inputSource,
@@ -51,6 +50,6 @@ public class SimpleMindeeClientV2 {
5150
System.out.println(response.getInference().toString());
5251

5352
// Access the result fields
54-
InferenceResult result = response.getInference().getResult();
53+
InferenceFields fields = response.getInference().getResult().getFields();
5554
}
5655
}

docs/code_samples/v2_ocr.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import com.mindee.input.LocalInputSource;
33
import com.mindee.v2.product.ocr.OcrResponse;
44
import com.mindee.v2.product.ocr.OcrResult;
55
import com.mindee.v2.product.ocr.params.OcrParameters;
6-
import java.io.File;
76
import java.io.IOException;
87

98
public class SimpleMindeeClientV2 {
@@ -19,7 +18,6 @@ public class SimpleMindeeClientV2 {
1918
MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey);
2019

2120
// Set inference parameters
22-
// Note: modelId is mandatory.
2321
OcrParameters ocrParams = OcrParameters
2422
// ID of the model, required.
2523
.builder(modelId)
@@ -28,7 +26,7 @@ public class SimpleMindeeClientV2 {
2826
// Load a file from disk
2927
LocalInputSource inputSource = new LocalInputSource(filePath);
3028

31-
// Send for processing
29+
// Send for processing using polling
3230
OcrResponse response = mindeeClient.enqueueAndGetResult(
3331
OcrResponse.class,
3432
inputSource,

docs/code_samples/v2_split.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import com.mindee.input.LocalInputSource;
33
import com.mindee.v2.product.split.SplitResponse;
44
import com.mindee.v2.product.split.SplitResult;
55
import com.mindee.v2.product.split.params.SplitParameters;
6-
import java.io.File;
76
import java.io.IOException;
87

98
public class SimpleMindeeClientV2 {
@@ -19,7 +18,6 @@ public class SimpleMindeeClientV2 {
1918
MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey);
2019

2120
// Set inference parameters
22-
// Note: modelId is mandatory.
2321
SplitParameters splitParams = SplitParameters
2422
// ID of the model, required.
2523
.builder(modelId)
@@ -28,7 +26,7 @@ public class SimpleMindeeClientV2 {
2826
// Load a file from disk
2927
LocalInputSource inputSource = new LocalInputSource(filePath);
3028

31-
// Send for processing
29+
// Send for processing using polling
3230
SplitResponse response = mindeeClient.enqueueAndGetResult(
3331
SplitResponse.class,
3432
inputSource,

0 commit comments

Comments
 (0)