mindee-lite 5.0.0a1__py3-none-any.whl

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 (433) hide show
  1. docs/conf.py +76 -0
  2. local_test/future_code_sample.py +31 -0
  3. local_test/libless_test.py +56 -0
  4. local_test/load_prediction.py +13 -0
  5. local_test/modsearch.py +7 -0
  6. local_test/quick_findocV2_test.py +26 -0
  7. local_test/quick_findoc_test.py +20 -0
  8. local_test/script_bashir.py +112 -0
  9. local_test/script_crop.py +21 -0
  10. local_test/script_split.py +21 -0
  11. local_test/test_demo.py +4 -0
  12. local_test/test_exp_syntax.py +37 -0
  13. local_test/test_rag_and_options.py +41 -0
  14. local_test/test_sid.py +30 -0
  15. local_test/test_split.py +12 -0
  16. local_test/test_split_syntax.py +27 -0
  17. mindee/__init__.py +53 -0
  18. mindee/__main__.py +4 -0
  19. mindee/cli.py +7 -0
  20. mindee/client_mixin.py +23 -0
  21. mindee/client_options/__init__.py +0 -0
  22. mindee/client_options/polling_options.py +19 -0
  23. mindee/dependencies/__init__.py +9 -0
  24. mindee/dependencies/checkers.py +33 -0
  25. mindee/dependencies/decorators.py +30 -0
  26. mindee/error/__init__.py +27 -0
  27. mindee/error/geometry_error.py +2 -0
  28. mindee/error/mimetype_error.py +2 -0
  29. mindee/error/mindee_dependency_error.py +5 -0
  30. mindee/error/mindee_error.py +14 -0
  31. mindee/error/mindee_http_error.py +115 -0
  32. mindee/error/mindee_image_error.py +2 -0
  33. mindee/error/mindee_pdf_error.py +2 -0
  34. mindee/geometry/__init__.py +31 -0
  35. mindee/geometry/bbox.py +73 -0
  36. mindee/geometry/minmax.py +32 -0
  37. mindee/geometry/point.py +17 -0
  38. mindee/geometry/polygon.py +76 -0
  39. mindee/geometry/polygon_utils.py +36 -0
  40. mindee/geometry/quadrilateral.py +57 -0
  41. mindee/image/__init__.py +3 -0
  42. mindee/image/extracted_image.py +108 -0
  43. mindee/image/image_compressor.py +45 -0
  44. mindee/image/image_extractor.py +186 -0
  45. mindee/input/__init__.py +19 -0
  46. mindee/input/base_64_input.py +20 -0
  47. mindee/input/bytes_input.py +19 -0
  48. mindee/input/file_input.py +28 -0
  49. mindee/input/local_input_source.py +283 -0
  50. mindee/input/local_response.py +118 -0
  51. mindee/input/page_options.py +30 -0
  52. mindee/input/path_input.py +19 -0
  53. mindee/input/url_input_source.py +228 -0
  54. mindee/logger.py +9 -0
  55. mindee/mindee_http/__init__.py +11 -0
  56. mindee/mindee_http/response_validation.py +76 -0
  57. mindee/mindee_http/settings_mixin.py +15 -0
  58. mindee/parsing/__init__.py +5 -0
  59. mindee/parsing/common/__init__.py +15 -0
  60. mindee/parsing/common/common_response.py +29 -0
  61. mindee/parsing/common/string_dict.py +4 -0
  62. mindee/parsing/common/summary_helper.py +33 -0
  63. mindee/pdf/__init__.py +15 -0
  64. mindee/pdf/extracted_pdf.py +60 -0
  65. mindee/pdf/pdf_char_data.py +31 -0
  66. mindee/pdf/pdf_compressor.py +242 -0
  67. mindee/pdf/pdf_extractor.py +103 -0
  68. mindee/pdf/pdf_utils.py +300 -0
  69. mindee/py.typed +0 -0
  70. mindee/v1/__init__.py +17 -0
  71. mindee/v1/client.py +616 -0
  72. mindee/v1/client_options/__init__.py +4 -0
  73. mindee/v1/client_options/predict_options.py +28 -0
  74. mindee/v1/client_options/workflow_options.py +30 -0
  75. mindee/v1/commands/__init__.py +9 -0
  76. mindee/v1/commands/cli_parser.py +282 -0
  77. mindee/v1/commands/cli_products.py +109 -0
  78. mindee/v1/error/__init__.py +4 -0
  79. mindee/v1/error/mindee_api_error.py +5 -0
  80. mindee/v1/error/mindee_product_error.py +5 -0
  81. mindee/v1/mindee_http/__init__.py +14 -0
  82. mindee/v1/mindee_http/base_endpoint.py +24 -0
  83. mindee/v1/mindee_http/base_settings.py +63 -0
  84. mindee/v1/mindee_http/endpoint.py +388 -0
  85. mindee/v1/mindee_http/mindee_api.py +29 -0
  86. mindee/v1/mindee_http/workflow_endpoint.py +75 -0
  87. mindee/v1/mindee_http/workflow_settings.py +24 -0
  88. mindee/v1/parsing/__init__.py +8 -0
  89. mindee/v1/parsing/common/__init__.py +43 -0
  90. mindee/v1/parsing/common/api_request.py +28 -0
  91. mindee/v1/parsing/common/api_response.py +29 -0
  92. mindee/v1/parsing/common/async_predict_response.py +35 -0
  93. mindee/v1/parsing/common/document.py +84 -0
  94. mindee/v1/parsing/common/execution.py +84 -0
  95. mindee/v1/parsing/common/execution_file.py +15 -0
  96. mindee/v1/parsing/common/execution_priority.py +9 -0
  97. mindee/v1/parsing/common/extras/__init__.py +7 -0
  98. mindee/v1/parsing/common/extras/cropper_extra.py +19 -0
  99. mindee/v1/parsing/common/extras/extras.py +43 -0
  100. mindee/v1/parsing/common/extras/full_text_ocr_extra.py +18 -0
  101. mindee/v1/parsing/common/extras/rag_extra.py +11 -0
  102. mindee/v1/parsing/common/feedback_response.py +13 -0
  103. mindee/v1/parsing/common/inference.py +77 -0
  104. mindee/v1/parsing/common/job.py +50 -0
  105. mindee/v1/parsing/common/ocr/__init__.py +3 -0
  106. mindee/v1/parsing/common/ocr/mvision_v1.py +17 -0
  107. mindee/v1/parsing/common/ocr/ocr.py +15 -0
  108. mindee/v1/parsing/common/ocr/ocr_line.py +13 -0
  109. mindee/v1/parsing/common/ocr/ocr_page.py +75 -0
  110. mindee/v1/parsing/common/ocr/ocr_word.py +19 -0
  111. mindee/v1/parsing/common/orientation.py +38 -0
  112. mindee/v1/parsing/common/page.py +47 -0
  113. mindee/v1/parsing/common/predict_response.py +28 -0
  114. mindee/v1/parsing/common/prediction.py +18 -0
  115. mindee/v1/parsing/common/product.py +15 -0
  116. mindee/v1/parsing/common/workflow_response.py +21 -0
  117. mindee/v1/parsing/custom/__init__.py +11 -0
  118. mindee/v1/parsing/custom/classification.py +17 -0
  119. mindee/v1/parsing/custom/line_items.py +175 -0
  120. mindee/v1/parsing/custom/list.py +64 -0
  121. mindee/v1/parsing/generated/__init__.py +11 -0
  122. mindee/v1/parsing/generated/generated_list.py +54 -0
  123. mindee/v1/parsing/generated/generated_object.py +81 -0
  124. mindee/v1/parsing/standard/__init__.py +52 -0
  125. mindee/v1/parsing/standard/address.py +63 -0
  126. mindee/v1/parsing/standard/amount.py +44 -0
  127. mindee/v1/parsing/standard/base.py +197 -0
  128. mindee/v1/parsing/standard/boolean.py +33 -0
  129. mindee/v1/parsing/standard/classification.py +31 -0
  130. mindee/v1/parsing/standard/company_registration.py +45 -0
  131. mindee/v1/parsing/standard/date.py +54 -0
  132. mindee/v1/parsing/standard/locale.py +56 -0
  133. mindee/v1/parsing/standard/payment_details.py +93 -0
  134. mindee/v1/parsing/standard/position.py +78 -0
  135. mindee/v1/parsing/standard/tax.py +124 -0
  136. mindee/v1/parsing/standard/text.py +36 -0
  137. mindee/v1/pdf/__init__.py +4 -0
  138. mindee/v1/pdf/multi_receipts_extractor.py +33 -0
  139. mindee/v1/pdf/pdf_extractor.py +52 -0
  140. mindee/v1/product/__init__.py +96 -0
  141. mindee/v1/product/barcode_reader/__init__.py +9 -0
  142. mindee/v1/product/barcode_reader/barcode_reader_v1.py +37 -0
  143. mindee/v1/product/barcode_reader/barcode_reader_v1_document.py +45 -0
  144. mindee/v1/product/cropper/__init__.py +13 -0
  145. mindee/v1/product/cropper/cropper_v1.py +40 -0
  146. mindee/v1/product/cropper/cropper_v1_document.py +8 -0
  147. mindee/v1/product/cropper/cropper_v1_page.py +38 -0
  148. mindee/v1/product/custom/__init__.py +11 -0
  149. mindee/v1/product/custom/custom_v1.py +30 -0
  150. mindee/v1/product/custom/custom_v1_document.py +59 -0
  151. mindee/v1/product/custom/custom_v1_page.py +49 -0
  152. mindee/v1/product/financial_document/__init__.py +15 -0
  153. mindee/v1/product/financial_document/financial_document_v1.py +37 -0
  154. mindee/v1/product/financial_document/financial_document_v1_document.py +318 -0
  155. mindee/v1/product/financial_document/financial_document_v1_line_item.py +105 -0
  156. mindee/v1/product/fr/__init__.py +49 -0
  157. mindee/v1/product/fr/bank_account_details/__init__.py +23 -0
  158. mindee/v1/product/fr/bank_account_details/bank_account_details_v1.py +37 -0
  159. mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.py +46 -0
  160. mindee/v1/product/fr/bank_account_details/bank_account_details_v2.py +37 -0
  161. mindee/v1/product/fr/bank_account_details/bank_account_details_v2_bban.py +63 -0
  162. mindee/v1/product/fr/bank_account_details/bank_account_details_v2_document.py +56 -0
  163. mindee/v1/product/fr/carte_grise/__init__.py +9 -0
  164. mindee/v1/product/fr/carte_grise/carte_grise_v1.py +37 -0
  165. mindee/v1/product/fr/carte_grise/carte_grise_v1_document.py +313 -0
  166. mindee/v1/product/fr/id_card/__init__.py +23 -0
  167. mindee/v1/product/fr/id_card/id_card_v1.py +40 -0
  168. mindee/v1/product/fr/id_card/id_card_v1_document.py +99 -0
  169. mindee/v1/product/fr/id_card/id_card_v1_page.py +35 -0
  170. mindee/v1/product/fr/id_card/id_card_v2.py +40 -0
  171. mindee/v1/product/fr/id_card/id_card_v2_document.py +134 -0
  172. mindee/v1/product/fr/id_card/id_card_v2_page.py +42 -0
  173. mindee/v1/product/generated/__init__.py +11 -0
  174. mindee/v1/product/generated/generated_v1.py +31 -0
  175. mindee/v1/product/generated/generated_v1_document.py +40 -0
  176. mindee/v1/product/generated/generated_v1_page.py +42 -0
  177. mindee/v1/product/generated/generated_v1_prediction.py +78 -0
  178. mindee/v1/product/international_id/__init__.py +9 -0
  179. mindee/v1/product/international_id/international_id_v2.py +37 -0
  180. mindee/v1/product/international_id/international_id_v2_document.py +152 -0
  181. mindee/v1/product/invoice/__init__.py +13 -0
  182. mindee/v1/product/invoice/invoice_v4.py +37 -0
  183. mindee/v1/product/invoice/invoice_v4_document.py +285 -0
  184. mindee/v1/product/invoice/invoice_v4_line_item.py +105 -0
  185. mindee/v1/product/invoice_splitter/__init__.py +13 -0
  186. mindee/v1/product/invoice_splitter/invoice_splitter_v1.py +37 -0
  187. mindee/v1/product/invoice_splitter/invoice_splitter_v1_document.py +55 -0
  188. mindee/v1/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.py +51 -0
  189. mindee/v1/product/multi_receipts_detector/__init__.py +11 -0
  190. mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1.py +37 -0
  191. mindee/v1/product/multi_receipts_detector/multi_receipts_detector_v1_document.py +35 -0
  192. mindee/v1/product/passport/__init__.py +9 -0
  193. mindee/v1/product/passport/passport_v1.py +37 -0
  194. mindee/v1/product/passport/passport_v1_document.py +106 -0
  195. mindee/v1/product/receipt/__init__.py +13 -0
  196. mindee/v1/product/receipt/receipt_v5.py +37 -0
  197. mindee/v1/product/receipt/receipt_v5_document.py +180 -0
  198. mindee/v1/product/receipt/receipt_v5_line_item.py +77 -0
  199. mindee/v1/product/us/__init__.py +13 -0
  200. mindee/v1/product/us/bank_check/__init__.py +13 -0
  201. mindee/v1/product/us/bank_check/bank_check_v1.py +40 -0
  202. mindee/v1/product/us/bank_check/bank_check_v1_document.py +72 -0
  203. mindee/v1/product/us/bank_check/bank_check_v1_page.py +45 -0
  204. mindee/v2/__init__.py +40 -0
  205. mindee/v2/cli.py +11 -0
  206. mindee/v2/client.py +190 -0
  207. mindee/v2/client_options/__init__.py +0 -0
  208. mindee/v2/client_options/base_parameters.py +44 -0
  209. mindee/v2/commands/__init__.py +0 -0
  210. mindee/v2/commands/cli_parser.py +136 -0
  211. mindee/v2/error/__init__.py +4 -0
  212. mindee/v2/error/mindee_api_v2_error.py +5 -0
  213. mindee/v2/error/mindee_http_error_v2.py +51 -0
  214. mindee/v2/file_operations/__init__.py +12 -0
  215. mindee/v2/file_operations/crop.py +52 -0
  216. mindee/v2/file_operations/crop_files.py +20 -0
  217. mindee/v2/file_operations/split.py +38 -0
  218. mindee/v2/file_operations/split_files.py +20 -0
  219. mindee/v2/mindee_http/__init__.py +0 -0
  220. mindee/v2/mindee_http/mindee_api_v2.py +322 -0
  221. mindee/v2/mindee_http/response_validation_v2.py +35 -0
  222. mindee/v2/parsing/__init__.py +25 -0
  223. mindee/v2/parsing/error/__init__.py +4 -0
  224. mindee/v2/parsing/error/error_item.py +14 -0
  225. mindee/v2/parsing/error/error_response.py +30 -0
  226. mindee/v2/parsing/inference/__init__.py +0 -0
  227. mindee/v2/parsing/inference/base_inference.py +29 -0
  228. mindee/v2/parsing/inference/base_response.py +22 -0
  229. mindee/v2/parsing/inference/field/__init__.py +17 -0
  230. mindee/v2/parsing/inference/field/base_field.py +46 -0
  231. mindee/v2/parsing/inference/field/factory.py +17 -0
  232. mindee/v2/parsing/inference/field/field_confidence.py +36 -0
  233. mindee/v2/parsing/inference/field/field_location.py +28 -0
  234. mindee/v2/parsing/inference/field/inference_fields.py +63 -0
  235. mindee/v2/parsing/inference/field/list_field.py +58 -0
  236. mindee/v2/parsing/inference/field/object_field.py +133 -0
  237. mindee/v2/parsing/inference/field/simple_field.py +21 -0
  238. mindee/v2/parsing/inference/inference_active_options.py +64 -0
  239. mindee/v2/parsing/inference/inference_file.py +29 -0
  240. mindee/v2/parsing/inference/inference_job.py +14 -0
  241. mindee/v2/parsing/inference/inference_model.py +14 -0
  242. mindee/v2/parsing/inference/rag_metadata.py +10 -0
  243. mindee/v2/parsing/inference/raw_text.py +21 -0
  244. mindee/v2/parsing/inference/raw_text_page.py +11 -0
  245. mindee/v2/parsing/job/__init__.py +5 -0
  246. mindee/v2/parsing/job/job.py +55 -0
  247. mindee/v2/parsing/job/job_response.py +14 -0
  248. mindee/v2/parsing/job/job_webhook.py +35 -0
  249. mindee/v2/parsing/search/__init__.py +0 -0
  250. mindee/v2/parsing/search/model_webhook.py +17 -0
  251. mindee/v2/parsing/search/paginationmetadata.py +28 -0
  252. mindee/v2/parsing/search/search_model.py +25 -0
  253. mindee/v2/parsing/search/search_models.py +24 -0
  254. mindee/v2/parsing/search/search_response.py +32 -0
  255. mindee/v2/product/__init__.py +23 -0
  256. mindee/v2/product/classification/__init__.py +21 -0
  257. mindee/v2/product/classification/classification_classifier.py +22 -0
  258. mindee/v2/product/classification/classification_inference.py +27 -0
  259. mindee/v2/product/classification/classification_response.py +21 -0
  260. mindee/v2/product/classification/classification_result.py +16 -0
  261. mindee/v2/product/classification/params/__init__.py +5 -0
  262. mindee/v2/product/classification/params/classification_parameters.py +11 -0
  263. mindee/v2/product/crop/__init__.py +14 -0
  264. mindee/v2/product/crop/crop_inference.py +28 -0
  265. mindee/v2/product/crop/crop_item.py +43 -0
  266. mindee/v2/product/crop/crop_response.py +19 -0
  267. mindee/v2/product/crop/crop_result.py +29 -0
  268. mindee/v2/product/crop/params/__init__.py +3 -0
  269. mindee/v2/product/crop/params/crop_parameters.py +11 -0
  270. mindee/v2/product/extraction/__init__.py +21 -0
  271. mindee/v2/product/extraction/extraction_inference.py +28 -0
  272. mindee/v2/product/extraction/extraction_response.py +26 -0
  273. mindee/v2/product/extraction/extraction_result.py +27 -0
  274. mindee/v2/product/extraction/params/__init__.py +15 -0
  275. mindee/v2/product/extraction/params/data_schema.py +19 -0
  276. mindee/v2/product/extraction/params/data_schema_field.py +30 -0
  277. mindee/v2/product/extraction/params/data_schema_replace.py +20 -0
  278. mindee/v2/product/extraction/params/extraction_parameters.py +63 -0
  279. mindee/v2/product/extraction/params/string_data_class.py +17 -0
  280. mindee/v2/product/ocr/__init__.py +15 -0
  281. mindee/v2/product/ocr/ocr_inference.py +27 -0
  282. mindee/v2/product/ocr/ocr_page.py +23 -0
  283. mindee/v2/product/ocr/ocr_response.py +19 -0
  284. mindee/v2/product/ocr/ocr_result.py +19 -0
  285. mindee/v2/product/ocr/ocr_word.py +17 -0
  286. mindee/v2/product/ocr/params/__init__.py +3 -0
  287. mindee/v2/product/ocr/params/ocr_parameters.py +11 -0
  288. mindee/v2/product/split/__init__.py +13 -0
  289. mindee/v2/product/split/params/__init__.py +3 -0
  290. mindee/v2/product/split/params/split_parameters.py +11 -0
  291. mindee/v2/product/split/split_inference.py +28 -0
  292. mindee/v2/product/split/split_range.py +42 -0
  293. mindee/v2/product/split/split_response.py +19 -0
  294. mindee/v2/product/split/split_result.py +31 -0
  295. mindee/versions.py +21 -0
  296. mindee_lite-5.0.0a1.dist-info/METADATA +88 -0
  297. mindee_lite-5.0.0a1.dist-info/RECORD +433 -0
  298. mindee_lite-5.0.0a1.dist-info/WHEEL +5 -0
  299. mindee_lite-5.0.0a1.dist-info/entry_points.txt +3 -0
  300. mindee_lite-5.0.0a1.dist-info/licenses/LICENSE +21 -0
  301. mindee_lite-5.0.0a1.dist-info/top_level.txt +5 -0
  302. scripts/generate_lite_toml.py +42 -0
  303. tests/__init__.py +0 -0
  304. tests/conftest.py +16 -0
  305. tests/dependencies/__init__.py +0 -0
  306. tests/dependencies/test_dependencies.py +23 -0
  307. tests/input/__init__.py +0 -0
  308. tests/input/test_apply_page_options.py +164 -0
  309. tests/input/test_compression.py +232 -0
  310. tests/input/test_fix_pdf.py +24 -0
  311. tests/input/test_inputs.py +102 -0
  312. tests/test_geometry.py +137 -0
  313. tests/test_pkg_versions.py +34 -0
  314. tests/utils.py +55 -0
  315. tests/v1/__init__.py +0 -0
  316. tests/v1/api/__init__.py +0 -0
  317. tests/v1/api/test_async_response.py +121 -0
  318. tests/v1/api/test_feedback_response.py +14 -0
  319. tests/v1/api/test_response.py +86 -0
  320. tests/v1/extraction/__init__.py +0 -0
  321. tests/v1/extraction/test_image_extractor.py +46 -0
  322. tests/v1/extraction/test_invoice_splitter_auto_extraction.py +72 -0
  323. tests/v1/extraction/test_multi_receipts_extractor.py +121 -0
  324. tests/v1/extraction/test_pdf_extractor.py +85 -0
  325. tests/v1/extras/__init__.py +0 -0
  326. tests/v1/extras/test_extras_integration.py +31 -0
  327. tests/v1/extras/test_full_text_ocr.py +38 -0
  328. tests/v1/input/__init__.py +0 -0
  329. tests/v1/input/test_local_response.py +42 -0
  330. tests/v1/input/test_url_input_source_integration.py +65 -0
  331. tests/v1/mindee_http/__init__.py +0 -0
  332. tests/v1/mindee_http/test_error.py +116 -0
  333. tests/v1/parsing/__init__.py +0 -0
  334. tests/v1/parsing/common/__init__.py +0 -0
  335. tests/v1/parsing/common/test_ocr.py +14 -0
  336. tests/v1/parsing/common/test_orientation.py +25 -0
  337. tests/v1/parsing/standard/__init__.py +0 -0
  338. tests/v1/parsing/standard/test_amount.py +23 -0
  339. tests/v1/parsing/standard/test_date.py +27 -0
  340. tests/v1/parsing/standard/test_field.py +101 -0
  341. tests/v1/parsing/standard/test_locale.py +40 -0
  342. tests/v1/parsing/standard/test_payment_details.py +71 -0
  343. tests/v1/parsing/standard/test_position.py +36 -0
  344. tests/v1/parsing/standard/test_string.py +34 -0
  345. tests/v1/parsing/standard/test_tax.py +44 -0
  346. tests/v1/product/__init__.py +14 -0
  347. tests/v1/product/barcode_reader/__init__.py +0 -0
  348. tests/v1/product/barcode_reader/test_barcode_reader_v1.py +47 -0
  349. tests/v1/product/barcode_reader/test_barcode_reader_v1_regression.py +26 -0
  350. tests/v1/product/cropper/__init__.py +0 -0
  351. tests/v1/product/cropper/test_cropper_v1.py +66 -0
  352. tests/v1/product/cropper/test_cropper_v1_regression.py +26 -0
  353. tests/v1/product/custom/__init__.py +0 -0
  354. tests/v1/product/custom/test_custom_v1.py +124 -0
  355. tests/v1/product/custom/test_custom_v1_line_items.py +75 -0
  356. tests/v1/product/custom/test_custom_v1_v2.py +124 -0
  357. tests/v1/product/financial_document/__init__.py +0 -0
  358. tests/v1/product/financial_document/test_financial_document_v1.py +121 -0
  359. tests/v1/product/financial_document/test_financial_document_v1_regression.py +31 -0
  360. tests/v1/product/fr/__init__.py +0 -0
  361. tests/v1/product/fr/bank_account_details/__init__.py +0 -0
  362. tests/v1/product/fr/bank_account_details/test_bank_account_details_v1.py +50 -0
  363. tests/v1/product/fr/bank_account_details/test_bank_account_details_v1_regression.py +31 -0
  364. tests/v1/product/fr/bank_account_details/test_bank_account_details_v2.py +54 -0
  365. tests/v1/product/fr/bank_account_details/test_bank_account_details_v2_regression.py +31 -0
  366. tests/v1/product/fr/carte_grise/__init__.py +0 -0
  367. tests/v1/product/fr/carte_grise/test_carte_grise_v1.py +86 -0
  368. tests/v1/product/fr/carte_grise/test_carte_grise_v1_regression.py +26 -0
  369. tests/v1/product/fr/id_card/__init__.py +0 -0
  370. tests/v1/product/fr/id_card/test_id_card_v1.py +75 -0
  371. tests/v1/product/fr/id_card/test_id_card_v1_regression.py +26 -0
  372. tests/v1/product/fr/id_card/test_id_card_v2.py +80 -0
  373. tests/v1/product/fr/id_card/test_id_card_v2_regression.py +26 -0
  374. tests/v1/product/generated/__init__.py +0 -0
  375. tests/v1/product/generated/test_generated_v1.py +949 -0
  376. tests/v1/product/international_id/__init__.py +0 -0
  377. tests/v1/product/international_id/test_international_id_v2.py +61 -0
  378. tests/v1/product/invoice/__init__.py +0 -0
  379. tests/v1/product/invoice/test_invoice_v4.py +70 -0
  380. tests/v1/product/invoice/test_invoice_v4_regression.py +26 -0
  381. tests/v1/product/invoice_splitter/__init__.py +0 -0
  382. tests/v1/product/invoice_splitter/test_invoice_splitter_v1.py +46 -0
  383. tests/v1/product/invoice_splitter/test_invoice_splitter_v1_regression.py +25 -0
  384. tests/v1/product/multi_receipts_detector/__init__.py +0 -0
  385. tests/v1/product/multi_receipts_detector/test_multi_receipts_detector_v1.py +48 -0
  386. tests/v1/product/multi_receipts_detector/test_multi_receipts_detector_v1_regression.py +31 -0
  387. tests/v1/product/passport/__init__.py +0 -0
  388. tests/v1/product/passport/test_passport_v1.py +56 -0
  389. tests/v1/product/passport/test_passport_v1_regression.py +26 -0
  390. tests/v1/product/receipt/__init__.py +0 -0
  391. tests/v1/product/receipt/test_receipt_v5.py +59 -0
  392. tests/v1/product/receipt/test_receipt_v5_regression.py +26 -0
  393. tests/v1/product/us/__init__.py +0 -0
  394. tests/v1/product/us/bank_check/__init__.py +0 -0
  395. tests/v1/product/us/bank_check/test_bank_check_v1.py +71 -0
  396. tests/v1/product/us/bank_check/test_bank_check_v1_regression.py +26 -0
  397. tests/v1/test_cli.py +211 -0
  398. tests/v1/test_client.py +172 -0
  399. tests/v1/workflows/__init__.py +0 -0
  400. tests/v1/workflows/test_workflow.py +81 -0
  401. tests/v1/workflows/test_workflow_integration.py +111 -0
  402. tests/v2/__init__.py +0 -0
  403. tests/v2/file_operations/__init__.py +0 -0
  404. tests/v2/file_operations/test_crop_operation.py +71 -0
  405. tests/v2/file_operations/test_crop_operation_integration.py +67 -0
  406. tests/v2/file_operations/test_split_operation.py +57 -0
  407. tests/v2/file_operations/test_split_operation_integration.py +68 -0
  408. tests/v2/input/__init__.py +0 -0
  409. tests/v2/input/test_inference_parameters.py +85 -0
  410. tests/v2/input/test_local_response.py +51 -0
  411. tests/v2/parsing/__init__.py +0 -0
  412. tests/v2/parsing/test_job_response.py +61 -0
  413. tests/v2/product/__init__.py +0 -0
  414. tests/v2/product/classification/__init__.py +0 -0
  415. tests/v2/product/classification/test_classification_integration.py +36 -0
  416. tests/v2/product/classification/test_classification_response.py +50 -0
  417. tests/v2/product/crop/__init__.py +0 -0
  418. tests/v2/product/crop/test_crop_integration.py +32 -0
  419. tests/v2/product/crop/test_crop_response.py +97 -0
  420. tests/v2/product/extraction/__init__.py +0 -0
  421. tests/v2/product/extraction/test_extraction_response.py +341 -0
  422. tests/v2/product/ocr/__init__.py +0 -0
  423. tests/v2/product/ocr/test_ocr_integration.py +35 -0
  424. tests/v2/product/ocr/test_ocr_response.py +86 -0
  425. tests/v2/product/split/__init__.py +0 -0
  426. tests/v2/product/split/test_split_integration.py +32 -0
  427. tests/v2/product/split/test_split_response.py +80 -0
  428. tests/v2/product/utils.py +21 -0
  429. tests/v2/search/__init__.py +0 -0
  430. tests/v2/search/test_search_models.py +33 -0
  431. tests/v2/test_base_classes.py +49 -0
  432. tests/v2/test_client.py +340 -0
  433. tests/v2/test_client_integration.py +355 -0
docs/conf.py ADDED
@@ -0,0 +1,76 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ # -- Path setup --------------------------------------------------------------
8
+
9
+ # If extensions (or modules to document with autodoc) are in another directory,
10
+ # add these directories to sys.path here. If the directory is relative to the
11
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
12
+ #
13
+ # import os
14
+ # import sys
15
+ # sys.path.insert(0, os.path.abspath('.'))
16
+
17
+
18
+ # -- Project information -----------------------------------------------------
19
+
20
+ project = "Mindee Python Client"
21
+ copyright = "2022, Mindee"
22
+ author = "Mindee"
23
+
24
+
25
+ # -- General configuration ---------------------------------------------------
26
+
27
+ # Add any Sphinx extension module names here, as strings. They can be
28
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29
+ # ones.
30
+ extensions = [
31
+ "sphinx.ext.autodoc",
32
+ "sphinx_autodoc_typehints",
33
+ ]
34
+
35
+ # Add any paths that contain templates here, relative to this directory.
36
+ templates_path = ["_templates"]
37
+
38
+ # List of patterns, relative to source directory, that match files and
39
+ # directories to ignore when looking for source files.
40
+ # This pattern also affects html_static_path and html_extra_path.
41
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
42
+
43
+
44
+ # -- Options for HTML output -------------------------------------------------
45
+
46
+ # The theme to use for HTML and HTML Help pages. See the documentation for
47
+ # a list of builtin themes.
48
+ #
49
+ html_theme = "sphinx_rtd_theme"
50
+ html_theme_options = {
51
+ "body_max_width": "none",
52
+ }
53
+
54
+ # Add any paths that contain custom static files (such as style sheets) here,
55
+ # relative to this directory. They are copied after the builtin static files,
56
+ # so a file named "default.css" will overwrite the builtin "default.css".
57
+ html_static_path = []
58
+
59
+ # A list of paths that contain extra files not directly related to the documentation.
60
+ html_extra_path = ["extras"]
61
+
62
+
63
+ # -- autodoc -----------------------------------------------------------------
64
+
65
+ autodoc_member_order = "groupwise"
66
+ # autodoc_class_signature = "separated" # breaks new syntaxes
67
+
68
+ # Hides prepended module names wich caused some classes to overflow on the right of the screen.
69
+ add_module_names = False
70
+ autodoc_typehints = "description"
71
+ autodoc_default_options = {"exclude-members": "__init__"}
72
+
73
+ # -- autodoc-typehints -------------------------------------------------------
74
+
75
+ typehints_defaults = "comma"
76
+ suppress_warnings = ["ref.python"]
@@ -0,0 +1,31 @@
1
+ from pathlib import Path
2
+
3
+ from mindee.v1.client import Client, InferenceParameters
4
+ from mindee.v2.product.extraction.extraction_response import ExtractionResponse
5
+ from tests.v1.product import PRODUCT_DATA_DIR
6
+ from tests.test_inputs import FILE_TYPES_DIR
7
+
8
+ default_sample_path: Path = (
9
+ PRODUCT_DATA_DIR / "financial_document" / "default_sample.jpg"
10
+ )
11
+ blank_sample_path: Path = FILE_TYPES_DIR / "pdf" / "blank_1.pdf"
12
+
13
+ v2_client = Client("mk_IEn6iaNKYIgeP5hfRS4BkaZMkSINZw0C")
14
+ default_sample = v2_client.source_from_path(default_sample_path)
15
+ options = InferenceParameters(model_id="94340559-b994-45e6-8b5c-be626027f1b2")
16
+
17
+ response_default: ExtractionResponse = v2_client.enqueue_and_get_inference(
18
+ default_sample, options
19
+ )
20
+ # response: PollingResponse = v2_client.enqueue(input_doc, options)
21
+ # print(response.raw_http)
22
+ with open("local_test/default_sample.json", "w", encoding="utf-8") as out_file:
23
+ out_file.write(str(response_default.raw_http))
24
+
25
+ blank_sample = v2_client.source_from_path(blank_sample_path)
26
+ response_blank: ExtractionResponse = v2_client.enqueue_and_get_inference(
27
+ blank_sample, options
28
+ )
29
+
30
+ with open("local_test/blank.json", "w", encoding="utf-8") as out_file:
31
+ out_file.write(str(response_blank.raw_http))
@@ -0,0 +1,56 @@
1
+ import json
2
+ import time
3
+ import requests
4
+ from pathlib import Path
5
+
6
+
7
+ def send_file_with_polling(
8
+ file_path: str,
9
+ model_id: str,
10
+ api_key: str,
11
+ max_retries: int = 30,
12
+ polling_interval: int = 2,
13
+ ) -> dict:
14
+ upload_file = Path(file_path)
15
+ headers = {"Authorization": api_key}
16
+ form_data = {"model_id": model_id, "rag": False}
17
+ with upload_file.open("rb") as fh:
18
+ files = {"file": (upload_file.name, fh)}
19
+ print(f"Enqueuing file: {upload_file}")
20
+ response = requests.post(
21
+ url="http://127.0.0.1:3915/v2/inferences/enqueue",
22
+ files=files,
23
+ data=form_data,
24
+ headers=headers,
25
+ )
26
+ response.raise_for_status()
27
+ job_data = response.json().get("job")
28
+ polling_url = job_data.get("polling_url")
29
+
30
+ # Important to wait before attempting to poll
31
+ time.sleep(3)
32
+
33
+ # Poll for completion
34
+ for attempt in range(max_retries):
35
+ print(f"Polling on: {polling_url}")
36
+ poll_response = requests.get(polling_url, headers=headers, allow_redirects=False)
37
+ poll_data = poll_response.json()
38
+ job_status = poll_data.get("job", {}).get("status")
39
+ if poll_response.status_code == 302 or job_status == "Processed":
40
+ result_url = poll_data.get("job", {}).get("result_url")
41
+ print(f"Get result from: {result_url}")
42
+ result_response = requests.get(result_url, headers=headers)
43
+ result_data = result_response.json()
44
+ return result_data
45
+ # still processing, wait before next poll
46
+ time.sleep(polling_interval)
47
+ # If we've exhausted all retries
48
+ raise TimeoutError(f"Polling timed out after {max_retries} attempts")
49
+
50
+
51
+ response = send_file_with_polling(
52
+ file_path="/home/seb/work/mindee/client-lib-test-data/v2/products/financial_document/default_sample.jpg",
53
+ model_id="d52d4a67-5d9e-43bf-9203-0675d3bf1d6d",
54
+ api_key="md_9yc6r4cjdhxamdn1l6nbg7vnaj2y8psb",
55
+ )
56
+ print(json.dumps(response, indent=2))
@@ -0,0 +1,13 @@
1
+ import mindee
2
+ from pathlib import Path
3
+
4
+ mindee_client = mindee.Client()
5
+
6
+ in_path = "/home/seb/work/mindee/client-lib-test-data/products/us_healthcare_cards/response_v1/complete.json"
7
+ with open(in_path, "r", encoding="utf-8") as in_file:
8
+ print(in_file.read())
9
+ result = mindee_client.load_prediction(mindee.product.us.HealthcareCardV1, mindee.LocalResponse(in_path))
10
+ output_path = Path("local_test").resolve() / "out.txt"
11
+ output_path.parent.mkdir(parents=True, exist_ok=True)
12
+ with open(output_path, "w", encoding="utf-8") as out_file:
13
+ out_file.write(str(result.document))
@@ -0,0 +1,7 @@
1
+ from mindee.v2.client import Client
2
+
3
+
4
+ m_client = Client()
5
+
6
+ models = m_client.search_models(model_type="crop")
7
+ print(models)
@@ -0,0 +1,26 @@
1
+ from mindee.v1.client import Client, InferenceParameters, PollingOptions
2
+ import os
3
+ from mindee.logger import logger
4
+
5
+ LOG_LEVEL = os.getenv("LOG_LEVEL", "DEBUG").upper()
6
+
7
+ logger.info("Initializing Mindee client")
8
+ mindee_client = Client("md_afm8g0osoy5g9nxqr8lbrgyxhtz280zc")
9
+
10
+ input_doc = mindee_client.source_from_path(
11
+ "/home/seb/Downloads/cd457d57-dca6-4d65-a68d-e77215ba58ff.pdf"
12
+ )
13
+
14
+ result = mindee_client.enqueue_and_get_inference(
15
+ input_doc,
16
+ InferenceParameters(
17
+ model_id="b4126d15-3dd9-412f-8f78-7c4982583794",
18
+ confidence=True,
19
+ polling_options=PollingOptions(1, 1),
20
+ ),
21
+ )
22
+
23
+ print(result.raw_http)
24
+
25
+ # Print the document-level summary
26
+ # print(result.document.inference.prediction)
@@ -0,0 +1,20 @@
1
+ from mindee.v1.client import Client, AsyncPredictResponse
2
+ from mindee.v1 import product
3
+
4
+ # Init a new client
5
+ mindee_client = Client()
6
+
7
+ with open("/home/seb/Documents/lucca/5091817238976J.pdf", "rb") as f_rb:
8
+ input_doc = mindee_client.source_from_bytes(f_rb.read(), "filename.pdf")
9
+
10
+ # Load a file from disk and parse it.
11
+ result: AsyncPredictResponse = mindee_client.parse(
12
+ product.FinancialDocumentV1,
13
+ input_doc,
14
+ )
15
+
16
+ # Print a summary of the API result
17
+ print(result.raw_http)
18
+
19
+ # Print the document-level summary
20
+ # print(result.document.inference.prediction)
@@ -0,0 +1,112 @@
1
+ from pathlib import Path
2
+ from typing import Any, BinaryIO
3
+
4
+ from mindee import (
5
+ ClassificationParameters,
6
+ ClassificationResponse,
7
+ Client,
8
+ CropParameters,
9
+ CropResponse,
10
+ ExtractionParameters,
11
+ ExtractionResponse,
12
+ JobResponse,
13
+ LocalResponse,
14
+ OCRParameters,
15
+ OCRResponse,
16
+ PathInput,
17
+ SplitParameters,
18
+ SplitResponse,
19
+ )
20
+ import os
21
+
22
+ from mindee.input import BaseParameters
23
+ from mindee.parsing.common.common_response import CommonResponse
24
+
25
+
26
+ def full_parse(params, input_source) -> ExtractionResponse:
27
+ return mindee_client.enqueue_and_get_result(
28
+ ExtractionResponse,
29
+ input_source,
30
+ params,
31
+ )
32
+
33
+
34
+ def enqueue_only(params, input_source) -> JobResponse:
35
+ return mindee_client.enqueue(
36
+ input_source,
37
+ params,
38
+ )
39
+
40
+
41
+ def setup_params(
42
+ param_type: type[
43
+ ClassificationParameters
44
+ | CropParameters
45
+ | ExtractionParameters
46
+ | OCRParameters
47
+ | SplitParameters
48
+ ],
49
+ rag: bool = False,
50
+ raw_text: bool = False,
51
+ polygon: bool = False,
52
+ confidence: bool = False,
53
+ data_schema: str = None,
54
+ text_context: str = None,
55
+ alias: str = None,
56
+ ) -> BaseParameters:
57
+ kwargs: dict[str, Any] = {"close_file": False}
58
+ if alias:
59
+ kwargs["alias"] = alias
60
+ if param_type == ExtractionParameters:
61
+ kwargs = kwargs | {
62
+ "rag": rag,
63
+ "raw_text": raw_text,
64
+ "polygon": polygon,
65
+ "confidence": confidence,
66
+ "text_context": text_context,
67
+ "data_schema": data_schema,
68
+ }
69
+ return param_type(model_id=model_id, **kwargs)
70
+
71
+
72
+ def setup_input(path):
73
+ return PathInput(path)
74
+
75
+
76
+ def deserialize_webhook(
77
+ response: BinaryIO | str | Path | bytes,
78
+ product_type: type[
79
+ ClassificationResponse
80
+ | CropResponse
81
+ | ExtractionResponse
82
+ | JobResponse
83
+ | OCRResponse
84
+ | SplitResponse
85
+ ],
86
+ ) -> CommonResponse:
87
+ local_response = LocalResponse(response)
88
+ return local_response.deserialize_response(product_type)
89
+
90
+
91
+ os.environ["MINDEE_V2_BASE_URL"] = "http://localhost:3915/v2"
92
+
93
+ input_path = "/home/seb/Documents/blank_1.pdf"
94
+ model_id = "762d24e7-666c-411d-abb4-947190f64538"
95
+ api_key = "md_X1OvEuBk_ZMJBwII4wu5hb2e3sWlnQeAHaBwRyySbFM"
96
+
97
+ mindee_client = Client(api_key) # API key can be set from env `MINDEE_V2_API_KEY`
98
+
99
+ params = setup_params(ExtractionParameters)
100
+ local_input = setup_input(input_path)
101
+
102
+ # Example with inference
103
+ response_full_parse = full_parse(params, local_input)
104
+ print(response_full_parse)
105
+
106
+ job_response = enqueue_only(params, local_input)
107
+ # Print job ID
108
+ print(job_response.job.id)
109
+
110
+ # For webhook deserialization:
111
+ # webhook_response = deserialize_webhook(webhook_source, InferenceResponse)
112
+ # print(webhook_response)
@@ -0,0 +1,21 @@
1
+ from pathlib import Path
2
+
3
+ import mindee
4
+ from mindee import CropParameters, CropResponse
5
+ import os
6
+
7
+ dir_path = os.path.dirname(os.path.realpath(__file__))
8
+
9
+ client = mindee.Client("my_api_key")
10
+ model_id = "model_id"
11
+ local_input = mindee.PathInput("path/to/my/file.ext")
12
+ output_path = Path(dir_path) / "cropped_files"
13
+
14
+ params = CropParameters(model_id, close_file=False)
15
+
16
+ result = client.enqueue_and_get_result(CropResponse, local_input, params)
17
+
18
+ crop_files = result.extract_from_file(local_input)
19
+
20
+ output_path.mkdir(parents=True, exist_ok=True)
21
+ crop_files.save_all_to_disk(output_path)
@@ -0,0 +1,21 @@
1
+ from pathlib import Path
2
+
3
+ import mindee
4
+ from mindee import SplitParameters, SplitResponse
5
+ import os
6
+
7
+ dir_path = os.path.dirname(os.path.realpath(__file__))
8
+
9
+ client = mindee.Client("my_api_key")
10
+ model_id = "model_id"
11
+ local_input = mindee.PathInput("path/to/my/file.ext")
12
+ output_path = Path(dir_path) / "split_files"
13
+
14
+ params = SplitParameters(model_id, close_file=False)
15
+
16
+ result = client.enqueue_and_get_result(SplitResponse, local_input, params)
17
+
18
+ split_files = result.extract_from_file(local_input)
19
+
20
+ output_path.mkdir(parents=True, exist_ok=True)
21
+ split_files.save_all_to_disk(output_path)
@@ -0,0 +1,4 @@
1
+ import mindee
2
+
3
+ client = mindee.Client("my_api_key")
4
+ document = mindee.PathInput("/path/to/my/file.ext")
@@ -0,0 +1,37 @@
1
+ from mindee.v1.client import Client, InferenceParameters, InferenceResponse, PathInput
2
+
3
+ input_path = "/home/seb/Documents/blank_1.pdf"
4
+ api_key = "md_sMAC68Ixx5vvkp9aXCKn7pDUg2Rcx76H"
5
+ model_id = "8fde5151-aa18-4c70-9289-fa04e50ca3b9"
6
+
7
+ # Init a new client
8
+ mindee_client = Client(api_key)
9
+
10
+ # Set inference parameters
11
+ params = InferenceParameters(
12
+ # ID of the model, required.
13
+ model_id=model_id,
14
+ # Options: set to `True` or `False` to override defaults
15
+ # Enhance extraction accuracy with Retrieval-Augmented Generation.
16
+ rag=None,
17
+ # Extract the full text content from the document as strings.
18
+ raw_text=None,
19
+ # Calculate bounding box polygons for all fields.
20
+ polygon=None,
21
+ # Boost the precision and accuracy of all extractions.
22
+ # Calculate confidence scores for all fields.
23
+ confidence=None,
24
+ )
25
+
26
+ # Load a file from disk
27
+ input_source = PathInput(input_path)
28
+
29
+ # Send for processing
30
+ response = mindee_client.enqueue_and_get_result(
31
+ InferenceResponse,
32
+ input_source,
33
+ params,
34
+ )
35
+
36
+ # Print a brief summary of the parsed data
37
+ print(response.inference)
@@ -0,0 +1,41 @@
1
+ from mindee.logger import logger
2
+ from mindee.v1.client import Client, InferenceParameters, PathInput, PollingOptions
3
+
4
+ input_path = (
5
+ "/home/seb/Downloads/0657_2025-08-01 CARLOS LLOMPART CABELLO_AAACOMPA00387.pdf"
6
+ )
7
+ api_key = "mk_IEn6iaNKYIgeP5hfRS4BkaZMkSINZw0C"
8
+ model_id = "019a21ef-e0cc-4cc9-9694-57ff588b60f8"
9
+ LOG_FORMAT = "%(asctime)s | %(levelname)-8s | %(name)s | %(message)s"
10
+
11
+ # Init a new client
12
+ mindee_client = Client(api_key)
13
+
14
+ logger.info("Starting Mindee inference for %s with model %s", input_path, model_id)
15
+
16
+
17
+ # Set inference parameters
18
+ params = InferenceParameters(
19
+ # ID of the model, required.
20
+ model_id=model_id,
21
+ # Options: set to `True` or `False` to override defaults
22
+ # Enhance extraction accuracy with Retrieval-Augmented Generation.
23
+ rag=True,
24
+ # Extract the full text content from the document as strings.
25
+ raw_text=True,
26
+ # Calculate bounding box polygons for all fields.
27
+ polygon=False,
28
+ # Boost the precision and accuracy of all extractions.
29
+ # Calculate confidence scores for all fields.
30
+ confidence=False,
31
+ polling_options=PollingOptions(max_retries=2000),
32
+ )
33
+
34
+ # Load a file from disk
35
+ input_source = PathInput(input_path)
36
+
37
+ # Send for processing
38
+ response = mindee_client.enqueue_and_get_inference(input_source, params)
39
+
40
+ # Print a brief summary of the parsed data
41
+ print(response.raw_http)
local_test/test_sid.py ADDED
@@ -0,0 +1,30 @@
1
+ from mindee.v1.client import Client, InferenceParameters, PollingOptions
2
+ import os
3
+ from mindee.logger import logger
4
+
5
+ LOG_LEVEL = os.getenv("LOG_LEVEL", "DEBUG").upper()
6
+
7
+ model_id = "YOUR-MODEL-ID"
8
+ filepath = "/path/to/your/file.ext"
9
+ api_key = "YOUR_APIKEY"
10
+
11
+ logger.info("Initializing Mindee client")
12
+ mindee_client = Client(api_key)
13
+
14
+ input_doc = mindee_client.source_from_path(filepath)
15
+
16
+ result = mindee_client.enqueue_and_get_inference(
17
+ input_doc,
18
+ InferenceParameters(
19
+ model_id=model_id,
20
+ confidence=False,
21
+ polygon=False,
22
+ raw_text=False,
23
+ rag=False,
24
+ alias=None,
25
+ text_context=None,
26
+ webhook_ids=[],
27
+ ),
28
+ )
29
+
30
+ print(result.raw_http)
@@ -0,0 +1,12 @@
1
+ from mindee.v1.client import Client
2
+ from mindee.input import SplitParameters
3
+ from mindee.v2 import SplitResponse
4
+
5
+ client = Client("md_sMAC68Ixx5vvkp9aXCKn7pDUg2Rcx76H")
6
+ input_source = client.source_from_path(
7
+ "./tests/data/v1/products/invoice_splitter/default_sample.pdf"
8
+ )
9
+ response = client.enqueue_and_get_result(
10
+ SplitResponse, input_source, SplitParameters("7cfb736e-651e-4407-a82d-f437025810a0")
11
+ )
12
+ print(response.inference)
@@ -0,0 +1,27 @@
1
+ from mindee.v1.client import Client, SplitParameters, SplitResponse, PathInput
2
+
3
+ input_path = "/home/seb/Documents/blank_1.pdf"
4
+ api_key = "md_sMAC68Ixx5vvkp9aXCKn7pDUg2Rcx76H"
5
+ model_id = "788c19ba-8005-4e63-ae83-80253fb7c27d"
6
+
7
+ # Init a new client
8
+ mindee_client = Client(api_key)
9
+
10
+ # Set inference parameters
11
+ params = SplitParameters(
12
+ # ID of the model, required.
13
+ model_id=model_id,
14
+ )
15
+
16
+ # Load a file from disk
17
+ input_source = PathInput(input_path)
18
+
19
+ # Send for processing
20
+ response = mindee_client.enqueue_and_get_result(
21
+ SplitResponse,
22
+ input_source,
23
+ params,
24
+ )
25
+
26
+ # Print a brief summary of the parsed data
27
+ print(response.inference)
mindee/__init__.py ADDED
@@ -0,0 +1,53 @@
1
+ from mindee.client_options.polling_options import PollingOptions
2
+ from mindee.input import PageOptions
3
+ from mindee.input.base_64_input import Base64Input
4
+ from mindee.input.bytes_input import BytesInput
5
+ from mindee.input.file_input import FileInput
6
+ from mindee.input.local_input_source import LocalInputSource
7
+ from mindee.input.local_response import LocalResponse
8
+ from mindee.input.path_input import PathInput
9
+ from mindee.input.url_input_source import URLInputSource
10
+ from mindee.v1 import product
11
+ from mindee.v2.parsing.job.job_response import JobResponse
12
+ from mindee.v2.product.classification.classification_response import (
13
+ ClassificationResponse,
14
+ )
15
+ from mindee.v2.product.classification.params.classification_parameters import (
16
+ ClassificationParameters,
17
+ )
18
+ from mindee.v2.product.crop.crop_response import CropResponse
19
+ from mindee.v2.product.crop.params.crop_parameters import CropParameters
20
+ from mindee.v2.product.extraction.extraction_response import ExtractionResponse
21
+ from mindee.v2.product.extraction.extraction_result import ExtractionResult
22
+ from mindee.v2.product.extraction.params.extraction_parameters import (
23
+ ExtractionParameters,
24
+ )
25
+ from mindee.v2.product.ocr.ocr_response import OCRResponse
26
+ from mindee.v2.product.ocr.params.ocr_parameters import OCRParameters
27
+ from mindee.v2.product.split.params.split_parameters import SplitParameters
28
+ from mindee.v2.product.split.split_response import SplitResponse
29
+
30
+ __all__ = [
31
+ "Base64Input",
32
+ "BytesInput",
33
+ "ClassificationParameters",
34
+ "ClassificationResponse",
35
+ "CropParameters",
36
+ "CropResponse",
37
+ "ExtractionParameters",
38
+ "ExtractionResponse",
39
+ "ExtractionResult",
40
+ "FileInput",
41
+ "JobResponse",
42
+ "LocalInputSource",
43
+ "LocalResponse",
44
+ "OCRParameters",
45
+ "OCRResponse",
46
+ "PageOptions",
47
+ "PathInput",
48
+ "PollingOptions",
49
+ "SplitParameters",
50
+ "SplitResponse",
51
+ "URLInputSource",
52
+ "product",
53
+ ]
mindee/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from mindee.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
mindee/cli.py ADDED
@@ -0,0 +1,7 @@
1
+ from mindee.v1.commands.cli_parser import MindeeParser
2
+
3
+
4
+ def main() -> None:
5
+ """Run the Command Line Interface."""
6
+ parser = MindeeParser()
7
+ parser.call_parse()
mindee/client_mixin.py ADDED
@@ -0,0 +1,23 @@
1
+ from mindee.error import MindeeClientError
2
+
3
+
4
+ class ClientMixin:
5
+ """Mixin for clients V1 & V2 common static methods."""
6
+
7
+ @staticmethod
8
+ def _validate_async_params(
9
+ initial_delay_sec: float, delay_sec: float, max_retries: int
10
+ ) -> None:
11
+ min_delay = 1
12
+ min_initial_delay = 1
13
+ min_retries = 1
14
+ if delay_sec < min_delay:
15
+ raise MindeeClientError(
16
+ f"Cannot set auto-parsing delay to less than {min_delay} second(s)."
17
+ )
18
+ if initial_delay_sec < min_initial_delay:
19
+ raise MindeeClientError(
20
+ f"Cannot set initial parsing delay to less than {min_initial_delay} second(s)."
21
+ )
22
+ if max_retries < min_retries:
23
+ raise MindeeClientError(f"Cannot set retries to less than {min_retries}.")
File without changes
@@ -0,0 +1,19 @@
1
+ class PollingOptions:
2
+ """Options for asynchronous polling."""
3
+
4
+ initial_delay_sec: float
5
+ """Initial delay before the first polling attempt."""
6
+ delay_sec: float
7
+ """Delay between each polling attempt."""
8
+ max_retries: int
9
+ """Total number of polling attempts."""
10
+
11
+ def __init__(
12
+ self,
13
+ initial_delay_sec: float = 2,
14
+ delay_sec: float = 1.5,
15
+ max_retries: int = 80,
16
+ ):
17
+ self.initial_delay_sec = initial_delay_sec
18
+ self.delay_sec = delay_sec
19
+ self.max_retries = max_retries
@@ -0,0 +1,9 @@
1
+ from mindee.dependencies.checkers import PILLOW_AVAILABLE, PYPDFIUM2_AVAILABLE
2
+ from mindee.dependencies.decorators import requires_pillow, requires_pypdfium2
3
+
4
+ __all__ = [
5
+ "PILLOW_AVAILABLE",
6
+ "PYPDFIUM2_AVAILABLE",
7
+ "requires_pillow",
8
+ "requires_pypdfium2",
9
+ ]