doc-page-extractor 0.0.6__py3-none-any.whl → 0.0.7__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.

Potentially problematic release.


This version of doc-page-extractor might be problematic. Click here for more details.

@@ -1,5 +1,4 @@
1
1
  import os
2
- import torch
3
2
 
4
3
  from typing import Literal, Iterable
5
4
  from pathlib import Path
@@ -34,10 +33,6 @@ class DocExtractor:
34
33
  self._yolo: YOLOv10 | None = None
35
34
  self._layout: LayoutLMv3ForTokenClassification | None = None
36
35
 
37
- if self._device.startswith("cuda") and not torch.cuda.is_available():
38
- self._device = "cpu"
39
- print("Warn: cuda is not available, use cpu instead")
40
-
41
36
  def extract(
42
37
  self,
43
38
  image: Image,
@@ -83,7 +78,7 @@ class DocExtractor:
83
78
  source=source,
84
79
  imgsz=1024,
85
80
  conf=0.2,
86
- device=self._device # Device to use (e.g., "cuda:0" or "cpu")
81
+ device=self._device # Device to use (e.g., "cuda" or "cpu")
87
82
  )
88
83
  boxes = det_res[0].__dict__["boxes"]
89
84
  layouts: list[Layout] = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: doc-page-extractor
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: doc page extractor can identify text and format in images and return structured data.
5
5
  Home-page: https://github.com/Moskize91/doc-page-extractor
6
6
  Author: Tao Zeyu
@@ -10,7 +10,6 @@ License-File: LICENSE
10
10
  Requires-Dist: opencv-python<5.0,>=4.11.0
11
11
  Requires-Dist: pillow<11.0,>=10.3
12
12
  Requires-Dist: pyclipper<2.0,>=1.2.0
13
- Requires-Dist: onnxruntime<2.0,>=1.19.0
14
13
  Requires-Dist: numpy<2.0,>=1.24.0
15
14
  Requires-Dist: shapely<3.0,>=2.0.0
16
15
  Requires-Dist: transformers<5.0,>=4.48.0
@@ -37,10 +36,20 @@ doc page extractor can identify text and format in images and return structured
37
36
  pip install doc-page-extractor
38
37
  ```
39
38
 
39
+ ```shell
40
+ pip install onnxruntime==1.21.0
41
+ ```
42
+
40
43
  ## Using CUDA
41
44
 
42
45
  Please refer to the introduction of [PyTorch](https://pytorch.org/get-started/locally/) and select the appropriate command to install according to your operating system.
43
46
 
47
+ In addition, replace the command to install `onnxruntime` in the previous article with the following:
48
+
49
+ ```shell
50
+ pip install onnxruntime-gpu==1.21.0
51
+ ```
52
+
44
53
  ## Example
45
54
 
46
55
  ```python
@@ -49,7 +58,7 @@ from doc_page_extractor import DocExtractor
49
58
 
50
59
  extractor = DocExtractor(
51
60
  model_dir_path=model_path, # Folder address where AI model is downloaded and installed
52
- device="cpu", # If you want to use CUDA, please change to device="cuda:0".
61
+ device="cpu", # If you want to use CUDA, please change to device="cuda".
53
62
  )
54
63
  with Image.open("/path/to/your/image.png") as image:
55
64
  result = extractor.extract(
@@ -1,7 +1,7 @@
1
1
  doc_page_extractor/__init__.py,sha256=jCf5lo3A9JVDquflYMlvH8nJIs3EjBt8AG5y8mwfS68,210
2
2
  doc_page_extractor/clipper.py,sha256=PDafB_9JGwV_dRY7oWe1yf44roSsEaCuEdg3VRMvJNo,3125
3
3
  doc_page_extractor/downloader.py,sha256=NbGN9ARnER8-gd4T1uc3W98WMEClVxMrqnShq8HibTw,455
4
- doc_page_extractor/extractor.py,sha256=aoan_RgSrZiz5LIvjTlr4UpM9ErttpEZ8puqRxwlmDU,10232
4
+ doc_page_extractor/extractor.py,sha256=D3SLWUAciq8jGU6mlkVwIon-4nHJaYoKpPjGCN_YLhQ,10055
5
5
  doc_page_extractor/layoutreader.py,sha256=BdC4oPbtpXoLmYhjuSFrKn6SNoT2zWw_gi95sGAUwrk,4031
6
6
  doc_page_extractor/ocr.py,sha256=6eLUVx6NSuRAwrq8Mc2zYs3yocxpOgUQS_4LIIqywnQ,5147
7
7
  doc_page_extractor/ocr_corrector.py,sha256=RfRA1jESEuqC8_a2kUEvHblT_B4xBjE0OApLMl1JiRg,3917
@@ -26,8 +26,8 @@ doc_page_extractor/onnxocr/rec_postprocess.py,sha256=qZt5Ripal7z9hniKq5e7azOkD9e
26
26
  doc_page_extractor/onnxocr/utils.py,sha256=AQoHgQyv-jpPo4BsVzq3r7_ze698EZ-a7LJobm2fwUI,1864
27
27
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  tests/test_history_bus.py,sha256=WaCUW3U75SESMcLq0f5FKnpVUVRDvmfxLFE7Zo83e48,2517
29
- doc_page_extractor-0.0.6.dist-info/LICENSE,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
30
- doc_page_extractor-0.0.6.dist-info/METADATA,sha256=A2fj-ylx5ug6h_eiTA4C-oFNpzRq8dP3-yQJ9ccyczQ,2046
31
- doc_page_extractor-0.0.6.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
32
- doc_page_extractor-0.0.6.dist-info/top_level.txt,sha256=ErNybD_lBzAmw8mVBAK4htsAH_hp14jioZVex-tUqvM,25
33
- doc_page_extractor-0.0.6.dist-info/RECORD,,
29
+ doc_page_extractor-0.0.7.dist-info/LICENSE,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
30
+ doc_page_extractor-0.0.7.dist-info/METADATA,sha256=s-ewJAyPQ1I_fgTee91NN99T42HcAaKFu1MAUhZKqdk,2203
31
+ doc_page_extractor-0.0.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
32
+ doc_page_extractor-0.0.7.dist-info/top_level.txt,sha256=ErNybD_lBzAmw8mVBAK4htsAH_hp14jioZVex-tUqvM,25
33
+ doc_page_extractor-0.0.7.dist-info/RECORD,,