carmen-cloud-client 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. carmen_cloud_client-1.0.0/.editorconfig +16 -0
  2. carmen_cloud_client-1.0.0/.env.example +4 -0
  3. carmen_cloud_client-1.0.0/.github/workflows/ci.yml +40 -0
  4. carmen_cloud_client-1.0.0/.gitignore +29 -0
  5. carmen_cloud_client-1.0.0/LICENSE +7 -0
  6. carmen_cloud_client-1.0.0/PKG-INFO +71 -0
  7. carmen_cloud_client-1.0.0/README.md +53 -0
  8. carmen_cloud_client-1.0.0/assets/transport/response.schema.json +240 -0
  9. carmen_cloud_client-1.0.0/assets/vehicle/response.schema.json +437 -0
  10. carmen_cloud_client-1.0.0/carmen_cloud_client/__init__.py +5 -0
  11. carmen_cloud_client-1.0.0/carmen_cloud_client/errors.py +27 -0
  12. carmen_cloud_client-1.0.0/carmen_cloud_client/test/__init__.py +1 -0
  13. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/__init__.py +0 -0
  14. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/accr_usa01.jpg +0 -0
  15. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/accr_usa02.jpg +0 -0
  16. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/accr_usa03.jpg +0 -0
  17. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/accr_usa20.jpg +0 -0
  18. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/bra01.jpg +0 -0
  19. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/bra02.jpg +0 -0
  20. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/bra03.jpg +0 -0
  21. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/bra20.jpg +0 -0
  22. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/chassis01.jpg +0 -0
  23. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/chassis02.jpg +0 -0
  24. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/chassis03.jpg +0 -0
  25. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/chassis20.jpg +0 -0
  26. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/ilu01.jpg +0 -0
  27. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/ilu02.jpg +0 -0
  28. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/ilu03.jpg +0 -0
  29. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/ilu20.jpg +0 -0
  30. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/iso01.jpg +0 -0
  31. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/iso02.jpg +0 -0
  32. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/iso03.jpg +0 -0
  33. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/iso20.jpg +0 -0
  34. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/test_client.py +230 -0
  35. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/uic01.jpg +0 -0
  36. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/uic02.jpg +0 -0
  37. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/uic03.jpg +0 -0
  38. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/uic20.jpg +0 -0
  39. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/usdot01.jpg +0 -0
  40. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/usdot02.jpg +0 -0
  41. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/usdot03.jpg +0 -0
  42. carmen_cloud_client-1.0.0/carmen_cloud_client/test/transport/usdot20.jpg +0 -0
  43. carmen_cloud_client-1.0.0/carmen_cloud_client/test/utils.py +8 -0
  44. carmen_cloud_client-1.0.0/carmen_cloud_client/test/vehicle/adr-test.jpg +0 -0
  45. carmen_cloud_client-1.0.0/carmen_cloud_client/test/vehicle/many_plates_hun.jpg +0 -0
  46. carmen_cloud_client-1.0.0/carmen_cloud_client/test/vehicle/test.jpg +0 -0
  47. carmen_cloud_client-1.0.0/carmen_cloud_client/test/vehicle/test_client.py +206 -0
  48. carmen_cloud_client-1.0.0/carmen_cloud_client/transport/__init__.py +2 -0
  49. carmen_cloud_client-1.0.0/carmen_cloud_client/transport/client.py +130 -0
  50. carmen_cloud_client-1.0.0/carmen_cloud_client/transport/options.py +35 -0
  51. carmen_cloud_client-1.0.0/carmen_cloud_client/transport/response.py +187 -0
  52. carmen_cloud_client-1.0.0/carmen_cloud_client/vehicle/__init__.py +3 -0
  53. carmen_cloud_client-1.0.0/carmen_cloud_client/vehicle/client.py +119 -0
  54. carmen_cloud_client-1.0.0/carmen_cloud_client/vehicle/options.py +365 -0
  55. carmen_cloud_client-1.0.0/carmen_cloud_client/vehicle/response.py +441 -0
  56. carmen_cloud_client-1.0.0/generate-response.sh +4 -0
  57. carmen_cloud_client-1.0.0/pyproject.toml +28 -0
  58. carmen_cloud_client-1.0.0/requirements-dev.txt +17 -0
  59. carmen_cloud_client-1.0.0/requirements.txt +8 -0
@@ -0,0 +1,16 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+ [*]
8
+ charset = utf-8
9
+ indent_style = space
10
+ indent_size = 4
11
+ end_of_line = lf
12
+ trim_trailing_whitespace = true
13
+ insert_final_newline = true
14
+
15
+ [*.py]
16
+ max_line_length = 120
@@ -0,0 +1,4 @@
1
+ TEST_DEV_API_KEY=
2
+ TEST_DEV_ENDPOINT_URL=https://api.dev.cloud.adaptiverecognition.com
3
+ TEST_EU_PROD_API_KEY=
4
+ TEST_US_PROD_API_KEY=
@@ -0,0 +1,40 @@
1
+ name: Python project CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ env:
10
+ TEST_DEV_API_KEY: ${{ secrets.API_TEST_EU_API_KEY_DEV }}
11
+ TEST_EU_PROD_API_KEY: ${{ secrets.API_TEST_EU_API_KEY_PROD }}
12
+ TEST_US_PROD_API_KEY: ${{ secrets.API_TEST_US_API_KEY_PROD }}
13
+ TEST_DEV_ENDPOINT_URL: ${{ secrets.TEST_DEV_ENDPOINT_URL }}
14
+
15
+ jobs:
16
+ build:
17
+
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Miniconda
23
+ uses: conda-incubator/setup-miniconda@v2
24
+ with:
25
+ miniconda-version: "latest"
26
+ activate-environment: myenv
27
+ environment-file: environment.yml
28
+ mamba-version: "*"
29
+ auto-activate-base: false
30
+
31
+ # - name: Install dependencies
32
+ # run: |
33
+ # echo "Installing dependencies"
34
+ # mamba install --file environment.yml
35
+
36
+ - name: Run tests
37
+ shell: bash -l {0}
38
+ run: |
39
+ echo "Running tests"
40
+ pytest
@@ -0,0 +1,29 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ dist/
11
+ build/
12
+ *.egg-info/
13
+
14
+ # Virtual environments
15
+ venv/
16
+ env/
17
+ ENV/
18
+ .env
19
+
20
+ # IDEs and editors
21
+ .idea/
22
+ .vscode/
23
+ *.sublime-project
24
+ *.sublime-workspace
25
+
26
+ # Miscellaneous
27
+ *.log
28
+ *.pyc
29
+ .DS_Store
@@ -0,0 +1,7 @@
1
+ Copyright 2023 Adaptive Recognition
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.1
2
+ Name: carmen_cloud_client
3
+ Version: 1.0.0
4
+ Summary: Python client for Carmen Cloud by Adaptive Recognition. Efficiently read license plates, recognize vehicle details, and process container, railway wagon, and US DOT codes.
5
+ Project-URL: Homepage, https://github.com/adaptiverecognition/python-carmen-cloud-client
6
+ Project-URL: Bug Tracker, https://github.com/adaptiverecognition/python-carmen-cloud-client/issues
7
+ Author-email: Botond BALÁZS <botond.balazs@arip.hu>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.7
13
+ Requires-Dist: pydantic>=1.10.9
14
+ Requires-Dist: requests-toolbelt>=1.0.0
15
+ Requires-Dist: requests>=2.31.0
16
+ Requires-Dist: urllib3>=2.0.3
17
+ Description-Content-Type: text/markdown
18
+
19
+ # Carmen Cloud Client by Adaptive Recognition
20
+
21
+ Python client for [Carmen Cloud](https://cloud.adaptiverecognition.com/) by [Adaptive Recognition](https://adaptiverecognition.com/). This unified library provides you with access to both the **Vehicle API** and the **Transportation & Cargo API**.
22
+
23
+ ## Supported API Versions
24
+
25
+ - Vehicle API: v1.4
26
+ - Transportation & Cargo API: v1.0
27
+
28
+ ## 🛠️ How to Install
29
+
30
+ ```sh
31
+ pip install adaptive-recognition-carmen-cloud-client
32
+ ```
33
+
34
+ ## 🚀 Usage
35
+
36
+ You can utilize either the Vehicle API or the Transportation & Cargo API based on your needs.
37
+
38
+ ### 🚗 Vehicle API
39
+
40
+ ```python
41
+ from carmen_cloud_client import VehicleAPIClient, SelectedServices, Locations
42
+
43
+ client = VehicleAPIClient(
44
+ api_key="<YOUR_API_KEY>",
45
+ services=SelectedServices(anpr=True, mmr=True),
46
+ input_image_location=Locations.Europe.Hungary,
47
+ cloud_service_region="EU"
48
+ )
49
+
50
+ response = client.send("./car.jpg")
51
+ print(response)
52
+ ```
53
+
54
+ ### 🚚 Transportation & Cargo API
55
+
56
+ ```python
57
+ from carmen_cloud_client import TransportAPIClient, CodeType
58
+
59
+ client = TransportAPIClient(
60
+ api_key="<YOUR_API_KEY>",
61
+ code_type=CodeType.ISO,
62
+ cloud_service_region="EU"
63
+ )
64
+
65
+ response = client.send("./container.jpg")
66
+ print(response)
67
+ ```
68
+
69
+ ## 🔧 Development
70
+
71
+ For more information about developing and contributing to this project, see [DEVELOPMENT.md](DEVELOPMENT.md).
@@ -0,0 +1,53 @@
1
+ # Carmen Cloud Client by Adaptive Recognition
2
+
3
+ Python client for [Carmen Cloud](https://cloud.adaptiverecognition.com/) by [Adaptive Recognition](https://adaptiverecognition.com/). This unified library provides you with access to both the **Vehicle API** and the **Transportation & Cargo API**.
4
+
5
+ ## Supported API Versions
6
+
7
+ - Vehicle API: v1.4
8
+ - Transportation & Cargo API: v1.0
9
+
10
+ ## 🛠️ How to Install
11
+
12
+ ```sh
13
+ pip install adaptive-recognition-carmen-cloud-client
14
+ ```
15
+
16
+ ## 🚀 Usage
17
+
18
+ You can utilize either the Vehicle API or the Transportation & Cargo API based on your needs.
19
+
20
+ ### 🚗 Vehicle API
21
+
22
+ ```python
23
+ from carmen_cloud_client import VehicleAPIClient, SelectedServices, Locations
24
+
25
+ client = VehicleAPIClient(
26
+ api_key="<YOUR_API_KEY>",
27
+ services=SelectedServices(anpr=True, mmr=True),
28
+ input_image_location=Locations.Europe.Hungary,
29
+ cloud_service_region="EU"
30
+ )
31
+
32
+ response = client.send("./car.jpg")
33
+ print(response)
34
+ ```
35
+
36
+ ### 🚚 Transportation & Cargo API
37
+
38
+ ```python
39
+ from carmen_cloud_client import TransportAPIClient, CodeType
40
+
41
+ client = TransportAPIClient(
42
+ api_key="<YOUR_API_KEY>",
43
+ code_type=CodeType.ISO,
44
+ cloud_service_region="EU"
45
+ )
46
+
47
+ response = client.send("./container.jpg")
48
+ print(response)
49
+ ```
50
+
51
+ ## 🔧 Development
52
+
53
+ For more information about developing and contributing to this project, see [DEVELOPMENT.md](DEVELOPMENT.md).
@@ -0,0 +1,240 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "title": "Transportation & Cargo API Response",
4
+ "description": "Response object returned by the Transportation & Cargo API on successful execution.",
5
+ "type": "object",
6
+ "properties": {
7
+ "nodename": {
8
+ "type": "string",
9
+ "title": "Node Name",
10
+ "description": "Name of the worker node that generated the response."
11
+ },
12
+ "nodetime": {
13
+ "type": "number",
14
+ "title": "Node Time",
15
+ "description": "The time, in milliseconds, it took to generate the response."
16
+ },
17
+ "version": {
18
+ "type": "string",
19
+ "title": "API version",
20
+ "description": "The version of the API that returned the response."
21
+ },
22
+ "data": {
23
+ "type": "object",
24
+ "title": "Image Recognition Result",
25
+ "description": "An object containing the results of the OCR operation.",
26
+ "properties": {
27
+ "codes": {
28
+ "type": "array",
29
+ "title": "Codes",
30
+ "description": "An array containing all codes recognized on the images uploaded.",
31
+ "items": {
32
+ "type": "object",
33
+ "title": "Code",
34
+ "description": "An object representing a code recognized by the OCR engine.",
35
+ "properties": {
36
+ "code": {
37
+ "type": "string",
38
+ "title": "Code",
39
+ "description": "The code as a string."
40
+ },
41
+ "confidence": {
42
+ "type": "integer",
43
+ "title": "Confidence",
44
+ "description": "The estimated probability of the recognized code being correct as a percentage between 0 and 100.",
45
+ "minimum": 0,
46
+ "maximum": 100
47
+ },
48
+ "imageResults": {
49
+ "type": "array",
50
+ "title": "Image Results",
51
+ "description": "An array in which each item corresponds to one image uploaded. The items are objects that describe the recognition results found on their respective input images.",
52
+ "items": {
53
+ "type": "object",
54
+ "title": "Image Result",
55
+ "description": "An object that describes the recognition results found on an uploaded image.",
56
+ "properties": {
57
+ "found": {
58
+ "type": "boolean",
59
+ "title": "Found",
60
+ "description": "A boolean indicating whether a code has been found on the image."
61
+ },
62
+ "text": {
63
+ "type": "string",
64
+ "title": "Text",
65
+ "description": "The code found on the image as a string."
66
+ },
67
+ "confidence": {
68
+ "type": "integer",
69
+ "title": "Confidence",
70
+ "description": "The estimated probability of the recognized code being correct as a percentage between 0 and 100."
71
+ },
72
+ "characters": {
73
+ "type": "array",
74
+ "title": "Characters",
75
+ "description": "An array of objects which describe each character of the recognized code.",
76
+ "items": {
77
+ "type": "object",
78
+ "title": "Character",
79
+ "description": "An object containing the recognition results associated with a single character of the recognized code.",
80
+ "properties": {
81
+ "code": {
82
+ "type": "integer",
83
+ "title": "Code",
84
+ "description": "The numeric code of the character."
85
+ },
86
+ "bgDark": {
87
+ "type": "boolean",
88
+ "title": "Dark Background",
89
+ "description": "A boolean indicating whether the background is darker than the character found."
90
+ },
91
+ "bgColor": {
92
+ "type": "object",
93
+ "title": "Background Color",
94
+ "description": "The color of the background of the character.",
95
+ "properties": {
96
+ "b": {
97
+ "type": "integer",
98
+ "title": "Blue",
99
+ "description": "The blue component of the color, 0-255.",
100
+ "minimum": 0,
101
+ "maximum": 255
102
+ },
103
+ "g": {
104
+ "type": "integer",
105
+ "title": "Green",
106
+ "description": "The green component of the color, 0-255.",
107
+ "minimum": 0,
108
+ "maximum": 255
109
+ },
110
+ "r": {
111
+ "type": "integer",
112
+ "title": "Red",
113
+ "description": "The red component of the color, 0-255.",
114
+ "minimum": 0,
115
+ "maximum": 255
116
+ }
117
+ }
118
+ },
119
+ "color": {
120
+ "type": "object",
121
+ "title": "Text Color",
122
+ "description": "The color of the character.",
123
+ "properties": {
124
+ "b": {
125
+ "type": "integer",
126
+ "title": "Blue",
127
+ "description": "The blue component of the color, 0-255.",
128
+ "minimum": 0,
129
+ "maximum": 255
130
+ },
131
+ "g": {
132
+ "type": "integer",
133
+ "title": "Green",
134
+ "description": "The green component of the color, 0-255.",
135
+ "minimum": 0,
136
+ "maximum": 255
137
+ },
138
+ "r": {
139
+ "type": "integer",
140
+ "title": "Red",
141
+ "description": "The red component of the color, 0-255.",
142
+ "minimum": 0,
143
+ "maximum": 255
144
+ }
145
+ }
146
+ },
147
+ "confidence": {
148
+ "type": "integer",
149
+ "title": "Confidence",
150
+ "description": "The estimated probability of the recognized character being correct as a percentage between 0 and 100."
151
+ },
152
+ "charROI": {
153
+ "type": "object",
154
+ "title": "Character Region of Interest",
155
+ "description": "The quadrangle (not necessarily a rectangle) where the character has been found.",
156
+ "properties": {
157
+ "bottomLeft": {
158
+ "type": "object",
159
+ "title": "Bottom Left",
160
+ "description": "Coordinates of the bottom left corner of the region in the uploaded image.",
161
+ "properties": {
162
+ "x": {
163
+ "type": "integer",
164
+ "title": "X coordinate",
165
+ "description": "The X coordinate of the corner."
166
+ },
167
+ "y": {
168
+ "type": "integer",
169
+ "title": "Y coordinate",
170
+ "description": "The Y coordinate of the corner."
171
+ }
172
+ }
173
+ },
174
+ "bottomRight": {
175
+ "type": "object",
176
+ "title": "Bottom Right",
177
+ "description": "Coordinates of the bottom right corner of the region in the uploaded image.",
178
+ "properties": {
179
+ "x": {
180
+ "type": "integer",
181
+ "title": "X coordinate",
182
+ "description": "The X coordinate of the corner."
183
+ },
184
+ "y": {
185
+ "type": "integer",
186
+ "title": "Y coordinate",
187
+ "description": "The Y coordinate of the corner."
188
+ }
189
+ }
190
+ },
191
+ "topLeft": {
192
+ "type": "object",
193
+ "title": "Top Left",
194
+ "description": "Coordinates of the top left corner of the region in the uploaded image.",
195
+ "properties": {
196
+ "x": {
197
+ "type": "integer",
198
+ "title": "X coordinate",
199
+ "description": "The X coordinate of the corner."
200
+ },
201
+ "y": {
202
+ "type": "integer",
203
+ "title": "Y coordinate",
204
+ "description": "The Y coordinate of the corner."
205
+ }
206
+ }
207
+ },
208
+ "topRight": {
209
+ "type": "object",
210
+ "title": "Top Right",
211
+ "description": "Coordinates of the top right corner of the region in the uploaded image.",
212
+ "properties": {
213
+ "x": {
214
+ "type": "integer",
215
+ "title": "X coordinate",
216
+ "description": "The X coordinate of the corner."
217
+ },
218
+ "y": {
219
+ "type": "integer",
220
+ "title": "Y coordinate",
221
+ "description": "The Y coordinate of the corner."
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+