mathcraft-ocr 0.2.3__tar.gz → 0.2.4__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.
Potentially problematic release.
This version of mathcraft-ocr might be problematic. Click here for more details.
- {mathcraft_ocr-0.2.3/mathcraft_ocr.egg-info → mathcraft_ocr-0.2.4}/PKG-INFO +1 -1
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/README.md +4 -4
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/__init__.py +1 -1
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/text_recognizer.py +6 -4
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/providers.py +8 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/serialization.py +2 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4/mathcraft_ocr.egg-info}/PKG-INFO +1 -1
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/pyproject.toml +1 -1
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/LICENSE +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/MANIFEST.in +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/README_MATHCRAFT_OCR.md +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/__main__.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/__init__.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/common.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/formula_detector.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/formula_recognizer.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/text_detector.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/api.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/cache.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/cli.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/debug_blocks.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/doctor.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/downloader.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/error_patterns.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/errors.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/formula_lines.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/hardware.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/image.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/latex_alignment.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/latex_quality.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/layout.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/manifest.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/manifests/models.v1.json +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/profiles.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/results.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/runtime.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/worker.py +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/SOURCES.txt +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/dependency_links.txt +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/entry_points.txt +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/requires.txt +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/top_level.txt +0 -0
- {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/setup.cfg +0 -0
|
@@ -6,7 +6,7 @@ MathCraft OCR recognizes formulae, text, and mixed mathematical documents with a
|
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
9
|
-
Current PyPI release line: `mathcraft-ocr 0.2.
|
|
9
|
+
Current PyPI release line: `mathcraft-ocr 0.2.4`.
|
|
10
10
|
|
|
11
11
|
Install the library and CLI without choosing an ONNX Runtime backend:
|
|
12
12
|
|
|
@@ -121,11 +121,11 @@ for block in result.blocks:
|
|
|
121
121
|
|
|
122
122
|
## Runtime Release Notes
|
|
123
123
|
|
|
124
|
-
`mathcraft-ocr 0.2.
|
|
124
|
+
`mathcraft-ocr 0.2.4` fixes DirectML provider handling for RapidOCR text recognition. CUDA and TensorRT providers enable CUDA runtime options, DirectML enables DirectML runtime options, and CPU remains CPU-only. The active `v1.0.0` ONNX model asset set is unchanged.
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
`mathcraft-ocr 0.2.3` fixes cross-platform hardware sizing. Memory detection now uses optional `psutil`, Windows API, POSIX `sysconf`, and macOS `vm_stat`, so CPU batch sizing no longer falls back to Windows-only memory data on Linux or macOS. It also moves the default writable model cache to platform-native user data locations on macOS and Linux.
|
|
127
127
|
|
|
128
|
-
Earlier `0.2.x` releases
|
|
128
|
+
Earlier `0.2.x` releases improved runtime-side formula post-processing without changing the active `v1.0.0` ONNX model asset set. They keep compact fraction expressions whole, avoid splitting matrix-like wide formulas, add relation-aware `aligned` output, and retry severe segmented-line artifacts with safer whole-line or whole-image recognition.
|
|
129
129
|
|
|
130
130
|
## Model Set
|
|
131
131
|
|
|
@@ -54,12 +54,14 @@ def recognize_pp_text_lines(
|
|
|
54
54
|
|
|
55
55
|
def _create_pp_text_recognizer(model_dir: Path, provider_info) -> TextRecognizer:
|
|
56
56
|
model_dir = model_dir.resolve()
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
active_provider = str(getattr(provider_info, "active_provider", "") or "")
|
|
58
|
+
use_cuda = active_provider in {"CUDAExecutionProvider", "TensorrtExecutionProvider"}
|
|
59
|
+
use_dml = active_provider == "DmlExecutionProvider"
|
|
60
|
+
return _create_pp_text_recognizer_cached(str(model_dir), use_cuda, use_dml)
|
|
59
61
|
|
|
60
62
|
|
|
61
63
|
@lru_cache(maxsize=8)
|
|
62
|
-
def _create_pp_text_recognizer_cached(model_dir: str, use_cuda: bool) -> TextRecognizer:
|
|
64
|
+
def _create_pp_text_recognizer_cached(model_dir: str, use_cuda: bool, use_dml: bool) -> TextRecognizer:
|
|
63
65
|
model_dir = Path(model_dir)
|
|
64
66
|
model_candidates = sorted(model_dir.glob("**/*rec*.onnx"))
|
|
65
67
|
if not model_candidates:
|
|
@@ -96,7 +98,7 @@ def _create_pp_text_recognizer_cached(model_dir: str, use_cuda: bool) -> TextRec
|
|
|
96
98
|
"cudnn_conv_algo_search": "EXHAUSTIVE",
|
|
97
99
|
"do_copy_in_default_stream": True,
|
|
98
100
|
},
|
|
99
|
-
"use_dml":
|
|
101
|
+
"use_dml": use_dml,
|
|
100
102
|
"dm_ep_cfg": None,
|
|
101
103
|
"use_cann": False,
|
|
102
104
|
"cann_ep_cfg": {
|
|
@@ -25,6 +25,14 @@ class ProviderInfo:
|
|
|
25
25
|
gpu_runtime_ok: bool
|
|
26
26
|
cpu_fallback: bool
|
|
27
27
|
|
|
28
|
+
@property
|
|
29
|
+
def use_cuda(self) -> bool:
|
|
30
|
+
return self.active_provider in {"CUDAExecutionProvider", "TensorrtExecutionProvider"}
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def use_dml(self) -> bool:
|
|
34
|
+
return self.active_provider == "DmlExecutionProvider"
|
|
35
|
+
|
|
28
36
|
|
|
29
37
|
def detect_providers(prefer: str = "auto") -> ProviderInfo:
|
|
30
38
|
prefer_norm = (prefer or "auto").strip().lower()
|
|
@@ -72,6 +72,8 @@ def provider_info_to_json(provider_info) -> dict:
|
|
|
72
72
|
"gpu_requested": provider_info.gpu_requested,
|
|
73
73
|
"gpu_runtime_ok": provider_info.gpu_runtime_ok,
|
|
74
74
|
"cpu_fallback": provider_info.cpu_fallback,
|
|
75
|
+
"use_cuda": provider_info.use_cuda,
|
|
76
|
+
"use_dml": provider_info.use_dml,
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|