switch to code formula model v1.0.1 and new test pdf

Signed-off-by: Matteo-Omenetti <Matteo.Omenetti1@ibm.com>
This commit is contained in:
Matteo-Omenetti 2025-02-04 14:12:42 +01:00
parent 89844a5725
commit 68d1713802
3 changed files with 5 additions and 5 deletions

View File

@ -62,7 +62,7 @@ class CodeFormulaModel(BaseItemAndImageEnrichmentModel):
"""
images_scale = 1.66 # = 120 dpi, aligned with training data resolution
expansion_factor = 0.05
expansion_factor = 0.03
def __init__(
self,

Binary file not shown.

View File

@ -48,11 +48,11 @@ def test_code_and_formula_conversion():
code_blocks = [el for el in results if isinstance(el, CodeItem)]
assert len(code_blocks) == 1
gt = 'int main() {\n printf("Hello, World!");\n return 0;\n}'
gt = 'function add(a, b) {\n return a + b;\n}\nconsole.log(add(3, 5));'
predicted = code_blocks[0].text.strip()
assert predicted == gt, f"mismatch in text {predicted=}, {gt=}"
assert code_blocks[0].code_language == CodeLanguageLabel.C_PLUS_PLUS
assert code_blocks[0].code_language == CodeLanguageLabel.JAVASCRIPT
formula_blocks = [
el
@ -61,6 +61,6 @@ def test_code_and_formula_conversion():
]
assert len(formula_blocks) == 1
gt = "a ^ { 2 } + 8 = 1 2"
gt = "x ^ { 2 } + 8 = 1 2"
predicted = formula_blocks[0].text
assert predicted == gt, f"mismatch in text {predicted=}, {gt=}"