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.

Files changed (43) hide show
  1. {mathcraft_ocr-0.2.3/mathcraft_ocr.egg-info → mathcraft_ocr-0.2.4}/PKG-INFO +1 -1
  2. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/README.md +4 -4
  3. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/__init__.py +1 -1
  4. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/text_recognizer.py +6 -4
  5. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/providers.py +8 -0
  6. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/serialization.py +2 -0
  7. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4/mathcraft_ocr.egg-info}/PKG-INFO +1 -1
  8. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/pyproject.toml +1 -1
  9. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/LICENSE +0 -0
  10. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/MANIFEST.in +0 -0
  11. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/README_MATHCRAFT_OCR.md +0 -0
  12. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/__main__.py +0 -0
  13. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/__init__.py +0 -0
  14. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/common.py +0 -0
  15. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/formula_detector.py +0 -0
  16. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/formula_recognizer.py +0 -0
  17. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/adapters/text_detector.py +0 -0
  18. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/api.py +0 -0
  19. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/cache.py +0 -0
  20. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/cli.py +0 -0
  21. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/debug_blocks.py +0 -0
  22. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/doctor.py +0 -0
  23. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/downloader.py +0 -0
  24. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/error_patterns.py +0 -0
  25. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/errors.py +0 -0
  26. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/formula_lines.py +0 -0
  27. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/hardware.py +0 -0
  28. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/image.py +0 -0
  29. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/latex_alignment.py +0 -0
  30. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/latex_quality.py +0 -0
  31. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/layout.py +0 -0
  32. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/manifest.py +0 -0
  33. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/manifests/models.v1.json +0 -0
  34. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/profiles.py +0 -0
  35. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/results.py +0 -0
  36. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/runtime.py +0 -0
  37. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr/worker.py +0 -0
  38. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/SOURCES.txt +0 -0
  39. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/dependency_links.txt +0 -0
  40. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/entry_points.txt +0 -0
  41. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/requires.txt +0 -0
  42. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/mathcraft_ocr.egg-info/top_level.txt +0 -0
  43. {mathcraft_ocr-0.2.3 → mathcraft_ocr-0.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathcraft-ocr
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: ONNX-only OCR runtime for mathematical documents
5
5
  Author: SakuraMathcraft
6
6
  License-Expression: MIT
@@ -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.3`.
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.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. The active `v1.0.0` ONNX model asset set is unchanged.
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
- 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.
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 updated the runtime-side formula recognition path with line-aware formula splitting and reassembly. This improved long multi-line formula handling without changing the active `v1.0.0` ONNX model asset set.
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "0.2.3"
5
+ __version__ = "0.2.4"
6
6
 
7
7
  __all__ = [
8
8
  "DoctorReport",
@@ -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
- use_cuda = bool(getattr(provider_info, "device", "") == "gpu")
58
- return _create_pp_text_recognizer_cached(str(model_dir), use_cuda)
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": False,
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathcraft-ocr
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: ONNX-only OCR runtime for mathematical documents
5
5
  Author: SakuraMathcraft
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mathcraft-ocr"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "ONNX-only OCR runtime for mathematical documents"
9
9
  readme = "README_MATHCRAFT_OCR.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes
File without changes