|
|
@@ -45,6 +45,15 @@ from ...models.formula_recognition.result import (
|
|
|
class FormulaRecognitionResult(BaseCVResult):
|
|
|
"""Formula Recognition Result"""
|
|
|
|
|
|
+ def _get_input_fn(self):
|
|
|
+ fn = super()._get_input_fn()
|
|
|
+ if (page_idx := self["page_index"]) is not None:
|
|
|
+ fp = Path(fn)
|
|
|
+ stem, suffix = fp.stem, fp.suffix
|
|
|
+ return f"{stem}_{page_idx}{suffix}"
|
|
|
+ else:
|
|
|
+ return fn
|
|
|
+
|
|
|
def _to_img(self) -> Dict[str, Image.Image]:
|
|
|
"""
|
|
|
Converts the internal data to a PIL Image with detection and recognition results.
|