File tree Expand file tree Collapse file tree 8 files changed +74
-17
lines changed
Expand file tree Collapse file tree 8 files changed +74
-17
lines changed Original file line number Diff line number Diff line change 44 workflow_call :
55 workflow_dispatch :
66
7+ env :
8+ MINDEE_API_KEY : ${{ secrets.MINDEE_API_KEY_SE_TESTS }}
9+ MINDEE_V2_API_KEY : ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }}
10+ MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID : ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }}
11+ MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID : ${{ secrets.MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID }}
12+ MINDEE_V2_SE_TESTS_CROP_MODEL_ID : ${{ secrets.MINDEE_V2_SE_TESTS_CROP_MODEL_ID }}
13+ MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID : ${{ secrets.MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID }}
14+ MINDEE_V2_SE_TESTS_OCR_MODEL_ID : ${{ secrets.MINDEE_V2_SE_TESTS_OCR_MODEL_ID }}
15+
716jobs :
817 test :
918 name : Run Code Samples
3847 python -m pip install pip
3948 pip install -e .
4049
41- - name : Tests code samples
50+ - name : Tests v2 sample code
51+ run : |
52+ ./tests/test_v2_code_samples.sh
53+
54+ - name : Tests v1 sample code
4255 run : |
43- ./tests/test_code_samples .sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }} ${{ secrets.MINDEE_API_KEY_SE_TESTS }} ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} ${{ secrets.MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID }} ${{ secrets.MINDEE_V2_SE_TESTS_CROP_MODEL_ID }} ${{ secrets.MINDEE_V2_SE_TESTS_OCR_MODEL_ID }} ${{ secrets.MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID }}
56+ ./tests/test_v1_code_samples .sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }}
4457
4558 - name : Notify Slack Action on Failure
4659 uses : ravsamhq/notify-slack-action@2.3.0
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ from mindee import (
77
88input_path = "/path/to/the/file.ext"
99api_key = "MY_API_KEY"
10- model_id = "MY_CLASSIFICATION_MODEL_ID "
10+ model_id = "MY_MODEL_ID "
1111
1212# Init a new client
1313mindee_client = ClientV2(api_key)
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ from mindee import (
77
88input_path = "/path/to/the/file.ext"
99api_key = "MY_API_KEY"
10- model_id = "MY_CROP_MODEL_ID "
10+ model_id = "MY_MODEL_ID "
1111
1212# Init a new client
1313mindee_client = ClientV2(api_key)
Original file line number Diff line number Diff line change @@ -42,3 +42,6 @@ response = mindee_client.enqueue_and_get_result(
4242
4343# Print a brief summary of the parsed data
4444print(response.inference)
45+
46+ # Access the result fields
47+ fields: dict = response.inference.result.fields
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ from mindee import (
77
88input_path = "/path/to/the/file.ext"
99api_key = "MY_API_KEY"
10- model_id = "MY_OCR_MODEL_ID "
10+ model_id = "MY_MODEL_ID "
1111
1212# Init a new client
1313mindee_client = ClientV2(api_key)
@@ -31,5 +31,5 @@ response = mindee_client.enqueue_and_get_result(
3131# Print a brief summary of the parsed data
3232print(response.inference)
3333
34- # Access the ocr result
34+ # Access the OCR result
3535pages: list = response.inference.result.pages
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ from mindee import (
77
88input_path = "/path/to/the/file.ext"
99api_key = "MY_API_KEY"
10- model_id = "MY_SPLIT_MODEL_ID "
10+ model_id = "MY_MODEL_ID "
1111
1212# Init a new client
1313mindee_client = ClientV2(api_key)
Original file line number Diff line number Diff line change 11#! /bin/sh
22set -e
33
4- OUTPUT_FILE=' ./_test .py'
4+ OUTPUT_FILE=' ./_test_v1 .py'
55ACCOUNT=$1
66ENDPOINT=$2
7- API_KEY=$3
8- API_KEY_V2=$4
9- MODEL_ID=$5
10- CLASSIFICATION_MODEL_ID=$6
11- CROP_MODEL_ID=$7
12- OCR_MODEL_ID=$8
13- SPLIT_MODEL_ID=$9
147
15- for f in $( find ./docs/extras/code_samples -maxdepth 1 -name " *.txt" -not -name " workflow_*.txt" | sort -h)
8+ for f in $(
9+ find ./docs/extras/code_samples -maxdepth 1 -name " *.txt" -not -name " workflow_*.txt" -not -name " v2_*.txt" | sort -h
10+ )
1611do
1712 if echo " ${f} " | grep -q " default_v2.txt" ; then
1813 if [ -z " ${API_KEY_V2} " ] || [ -z " ${MODEL_ID} " ]; then
2823 echo " ###############################################"
2924 echo
3025
31- sed " s/my-api-key/${API_KEY } /" " ${f} " > $OUTPUT_FILE
26+ sed " s/my-api-key/${MINDEE_API_KEY } /" " ${f} " > $OUTPUT_FILE
3227 sed -i ' s/\/path\/to\/the\/file.ext/.\/tests\/data\/file_types\/pdf\/blank_1.pdf/' $OUTPUT_FILE
3328
3429
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ OUTPUT_FILE=' ./_test_v2.py'
5+
6+ for f in $(
7+ find ./docs/extras/code_samples -maxdepth 1 -name " v2_*.txt" | sort -h
8+ )
9+ do
10+ echo
11+ echo " ###############################################"
12+ echo " ${f} "
13+ echo " ###############################################"
14+ echo
15+
16+ sed " s/MY_API_KEY/${MINDEE_V2_API_KEY} /" " ${f} " > $OUTPUT_FILE
17+ sed -i ' s/\/path\/to\/the\/file.ext/.\/tests\/data\/file_types\/pdf\/blank_1.pdf/' $OUTPUT_FILE
18+
19+ if echo " ${f} " | grep -q " v2_extraction.txt"
20+ then
21+ sed -i " s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID} /" $OUTPUT_FILE
22+ fi
23+
24+ if echo " ${f} " | grep -q " v2_classification.txt"
25+ then
26+ sed -i " s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID} /" $OUTPUT_FILE
27+ fi
28+
29+ if echo " ${f} " | grep -q " v2_crop.txt"
30+ then
31+ sed -i " s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_CROP_MODEL_ID} /" $OUTPUT_FILE
32+ fi
33+
34+ if echo " ${f} " | grep -q " v2_split.txt"
35+ then
36+ sed -i " s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID} /" $OUTPUT_FILE
37+ fi
38+
39+ if echo " ${f} " | grep -q " v2_ocr.txt"
40+ then
41+ sed -i " s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_OCR_MODEL_ID} /" $OUTPUT_FILE
42+ fi
43+
44+ sleep 0.5 # avoid too many request errors
45+ python $OUTPUT_FILE
46+ done
You can’t perform that action at this time.
0 commit comments