mirror of
https://github.com/VikParuchuri/surya.git
synced 2026-06-04 21:03:53 +08:00
Fix bad test - Add real latex image
Some checks failed
Integration test / build (push) Has been cancelled
Unit tests / build (t4_gpu) (push) Has been cancelled
Unit tests / build (ubuntu-latest) (push) Has been cancelled
Unit tests / build (windows-latest) (push) Has been cancelled
Test CLI scripts / build (push) Has been cancelled
Some checks failed
Integration test / build (push) Has been cancelled
Unit tests / build (t4_gpu) (push) Has been cancelled
Unit tests / build (ubuntu-latest) (push) Has been cancelled
Unit tests / build (windows-latest) (push) Has been cancelled
Test CLI scripts / build (push) Has been cancelled
This commit is contained in:
parent
e7ec40ecb4
commit
d4496f8caa
BIN
tests/assets/test_latex.png
Normal file
BIN
tests/assets/test_latex.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@ -79,3 +79,10 @@ def test_image_tall():
|
||||
font_size=24,
|
||||
)
|
||||
return image
|
||||
|
||||
@pytest.fixture()
|
||||
def test_image_latex():
|
||||
assets_dir = os.path.join(os.path.dirname(__file__), "assets")
|
||||
img_path = os.path.join(assets_dir, "test_latex.png")
|
||||
image = Image.open(img_path).convert("RGB")
|
||||
return image
|
||||
@ -6,13 +6,10 @@ from surya.common.surya.schema import TaskNames
|
||||
from surya.recognition import OCRResult
|
||||
|
||||
|
||||
def test_latex_ocr(recognition_predictor):
|
||||
img = Image.new("RGB", (200, 100), color="white")
|
||||
draw = ImageDraw.Draw(img)
|
||||
draw.text((10, 10), "E = mc2", fill="black", font_size=48)
|
||||
|
||||
def test_latex_ocr(recognition_predictor, test_image_latex):
|
||||
width, height = test_image_latex.size
|
||||
results: List[OCRResult] = recognition_predictor(
|
||||
[img], [TaskNames.block_without_boxes], bboxes=[[[0, 0, 200, 100]]]
|
||||
[test_image_latex], [TaskNames.block_without_boxes], bboxes=[[[0, 0, width, height]]]
|
||||
)
|
||||
text = results[0].text_lines[0].text
|
||||
assert len(results) == 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user