mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
feat: Remove OCR Support (#2838)
* remove ocr package * remove tesseract * remove OCR from app * remove OCR from tests * fix docs
This commit is contained in:
parent
c48680374d
commit
ca9f66ee24
34 changed files with 29 additions and 1570 deletions
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -1,73 +0,0 @@
|
|||
level page_num block_num par_num line_num word_num left top width height conf text
|
||||
1 1 0 0 0 0 0 0 640 480 -1
|
||||
2 1 1 0 0 0 36 92 582 269 -1
|
||||
3 1 1 1 0 0 36 92 582 92 -1
|
||||
4 1 1 1 1 0 36 92 544 30 -1
|
||||
5 1 1 1 1 1 36 92 60 24 87.137558 This
|
||||
5 1 1 1 1 2 109 92 20 24 87.137558 is
|
||||
5 1 1 1 1 3 141 98 15 18 87.823906 a
|
||||
5 1 1 1 1 4 169 92 32 24 87.823906 lot
|
||||
5 1 1 1 1 5 212 92 28 24 92.965874 of
|
||||
5 1 1 1 1 6 251 92 31 24 93.247513 12
|
||||
5 1 1 1 1 7 296 92 68 30 92.734741 point
|
||||
5 1 1 1 1 8 374 93 53 23 92.996040 text
|
||||
5 1 1 1 1 9 437 93 26 23 93.160057 to
|
||||
5 1 1 1 1 10 474 93 52 23 92.312637 test
|
||||
5 1 1 1 1 11 536 92 44 24 92.312637 the
|
||||
4 1 1 1 2 0 36 126 582 31 -1
|
||||
5 1 1 1 2 1 36 132 45 18 90.505524 ocr
|
||||
5 1 1 1 2 2 91 126 69 24 90.505524 code
|
||||
5 1 1 1 2 3 172 126 51 24 91.169167 and
|
||||
5 1 1 1 2 4 236 132 50 18 89.765854 see
|
||||
5 1 1 1 2 5 299 126 15 24 85.827324 if
|
||||
5 1 1 1 2 6 325 126 14 24 93.116241 it
|
||||
5 1 1 1 2 7 348 126 85 24 92.394562 works
|
||||
5 1 1 1 2 8 445 132 33 18 30.119690 on
|
||||
5 1 1 1 2 9 500 126 29 24 30.119690 all
|
||||
5 1 1 1 2 10 541 127 77 30 92.090988 types
|
||||
4 1 1 1 3 0 36 160 187 24 -1
|
||||
5 1 1 1 3 1 36 160 28 24 92.476135 of
|
||||
5 1 1 1 3 2 72 160 41 24 90.919365 file
|
||||
5 1 1 1 3 3 123 160 100 24 91.360367 format.
|
||||
3 1 1 2 0 0 36 194 561 167 -1
|
||||
4 1 1 2 1 0 36 194 549 31 -1
|
||||
5 1 1 2 1 1 36 194 55 24 89.098892 The
|
||||
5 1 1 2 1 2 102 194 75 30 89.098892 quick
|
||||
5 1 1 2 1 3 189 194 85 24 91.415680 brown
|
||||
5 1 1 2 1 4 287 194 52 31 91.943085 dog
|
||||
5 1 1 2 1 5 348 194 108 31 92.167969 jumped
|
||||
5 1 1 2 1 6 468 200 63 18 91.970985 over
|
||||
5 1 1 2 1 7 540 194 45 24 92.843704 the
|
||||
4 1 1 2 2 0 37 228 548 31 -1
|
||||
5 1 1 2 2 1 37 228 55 31 92.262550 lazy
|
||||
5 1 1 2 2 2 103 228 50 24 92.693161 fox.
|
||||
5 1 1 2 2 3 165 228 55 24 92.947639 The
|
||||
5 1 1 2 2 4 232 228 75 30 90.589806 quick
|
||||
5 1 1 2 2 5 319 228 85 24 91.051247 brown
|
||||
5 1 1 2 2 6 417 228 51 31 91.925011 dog
|
||||
5 1 1 2 2 7 478 228 107 31 91.471077 jumped
|
||||
4 1 1 2 3 0 36 262 561 31 -1
|
||||
5 1 1 2 3 1 36 268 63 18 90.210129 over
|
||||
5 1 1 2 3 2 109 262 44 24 90.210129 the
|
||||
5 1 1 2 3 3 165 262 56 31 91.178192 lazy
|
||||
5 1 1 2 3 4 231 262 50 24 92.794647 fox.
|
||||
5 1 1 2 3 5 294 262 55 24 91.388016 The
|
||||
5 1 1 2 3 6 360 262 75 30 92.525742 quick
|
||||
5 1 1 2 3 7 447 262 85 24 90.425552 brown
|
||||
5 1 1 2 3 8 545 262 52 31 90.425552 dog
|
||||
4 1 1 2 4 0 43 296 518 31 -1
|
||||
5 1 1 2 4 1 43 296 107 31 91.759590 jumped
|
||||
5 1 1 2 4 2 162 302 64 18 92.923576 over
|
||||
5 1 1 2 4 3 235 296 44 24 92.017929 the
|
||||
5 1 1 2 4 4 292 296 55 31 91.558884 lazy
|
||||
5 1 1 2 4 5 357 296 50 24 92.687485 fox.
|
||||
5 1 1 2 4 6 420 296 55 24 91.922661 The
|
||||
5 1 1 2 4 7 486 296 75 30 91.870224 quick
|
||||
4 1 1 2 5 0 37 330 524 31 -1
|
||||
5 1 1 2 5 1 37 330 85 24 92.923935 brown
|
||||
5 1 1 2 5 2 135 330 52 31 91.468765 dog
|
||||
5 1 1 2 5 3 196 330 108 31 91.425491 jumped
|
||||
5 1 1 2 5 4 316 336 63 18 91.489830 over
|
||||
5 1 1 2 5 5 388 330 45 24 91.740379 the
|
||||
5 1 1 2 5 6 445 330 55 31 92.110054 lazy
|
||||
5 1 1 2 5 7 511 330 50 24 93.180054 fox.
|
|
|
@ -1,9 +0,0 @@
|
|||
This is a lot of 12 point text to test the
|
||||
ocr code and see if it works on all types
|
||||
of file format.
|
||||
|
||||
The quick brown dog jumped over the
|
||||
lazy fox. The quick brown dog jumped
|
||||
over the lazy fox. The quick brown dog
|
||||
jumped over the lazy fox. The quick
|
||||
brown dog jumped over the lazy fox.
|
|
@ -1,58 +0,0 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from mealie.services.ocr.pytesseract import OcrService
|
||||
|
||||
ocr_service = OcrService()
|
||||
|
||||
|
||||
@pytest.mark.skip("Tesseract is not reliable between environments")
|
||||
def test_image_to_string():
|
||||
with open(Path("tests/data/images/test-ocr.png"), "rb") as image:
|
||||
result = ocr_service.image_to_string(image)
|
||||
with open(Path("tests/data/text/test-ocr.txt"), encoding="utf-8") as expected_result:
|
||||
assert result == expected_result.read()
|
||||
|
||||
|
||||
@pytest.mark.skip("Tesseract is not reliable between environments")
|
||||
def test_image_to_tsv():
|
||||
with open(Path("tests/data/images/test-ocr.png"), "rb") as image:
|
||||
result = ocr_service.image_to_tsv(image.read())
|
||||
with open(Path("tests/data/text/test-ocr.tsv"), encoding="utf-8") as expected_result:
|
||||
assert result == expected_result.read()
|
||||
|
||||
|
||||
def test_format_tsv_output():
|
||||
tsv = " level\tpage_num\tblock_num\tpar_num\tline_num\tword_num\tleft\ttop\twidth\theight\tconf\ttext \n1\t1\t0\t0\t0\t0\t0\t0\t640\t480\t-1\t\n5\t1\t1\t1\t1\t1\t36\t92\t60\t24\t87.137558\tThis"
|
||||
expected_result = [
|
||||
{
|
||||
"level": 1,
|
||||
"page_num": 1,
|
||||
"block_num": 0,
|
||||
"par_num": 0,
|
||||
"line_num": 0,
|
||||
"word_num": 0,
|
||||
"left": 0,
|
||||
"top": 0,
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"conf": -1.0,
|
||||
"text": "",
|
||||
},
|
||||
{
|
||||
"level": 5,
|
||||
"page_num": 1,
|
||||
"block_num": 1,
|
||||
"par_num": 1,
|
||||
"line_num": 1,
|
||||
"word_num": 1,
|
||||
"left": 36,
|
||||
"top": 92,
|
||||
"width": 60,
|
||||
"height": 24,
|
||||
"conf": 87.137558,
|
||||
"text": "This",
|
||||
},
|
||||
]
|
||||
assert ocr_service.format_tsv_output(tsv) == expected_result
|
|
@ -113,12 +113,6 @@ groups_webhooks_rerun = "/api/groups/webhooks/rerun"
|
|||
"""`/api/groups/webhooks/rerun`"""
|
||||
media_docker_validate_txt = "/api/media/docker/validate.txt"
|
||||
"""`/api/media/docker/validate.txt`"""
|
||||
ocr = "/api/ocr/"
|
||||
"""`/api/ocr/`"""
|
||||
ocr_asset_to_tsv = "/api/ocr/asset-to-tsv"
|
||||
"""`/api/ocr/asset-to-tsv`"""
|
||||
ocr_file_to_tsv = "/api/ocr/file-to-tsv"
|
||||
"""`/api/ocr/file-to-tsv`"""
|
||||
organizers_categories = "/api/organizers/categories"
|
||||
"""`/api/organizers/categories`"""
|
||||
organizers_categories_empty = "/api/organizers/categories/empty"
|
||||
|
@ -151,8 +145,6 @@ recipes_bulk_actions_tag = "/api/recipes/bulk-actions/tag"
|
|||
"""`/api/recipes/bulk-actions/tag`"""
|
||||
recipes_create_from_zip = "/api/recipes/create-from-zip"
|
||||
"""`/api/recipes/create-from-zip`"""
|
||||
recipes_create_ocr = "/api/recipes/create-ocr"
|
||||
"""`/api/recipes/create-ocr`"""
|
||||
recipes_create_url = "/api/recipes/create-url"
|
||||
"""`/api/recipes/create-url`"""
|
||||
recipes_create_url_bulk = "/api/recipes/create-url/bulk"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue