Fix CI (introduced by OCR PR #1349) (#1399)

* satisfy mypy

* add import
This commit is contained in:
Malte Pietsch 2021-09-01 17:16:05 +02:00 committed by GitHub
parent 6093bf9ff6
commit e4c3c3d423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import logging
import subprocess
from pathlib import Path
from typing import List, Optional, Dict, Any
from typing import List, Optional, Dict, Any, Union
import pytesseract
from PIL.PpmImagePlugin import PpmImageFile
@ -78,7 +78,7 @@ class ImageToTextConverter(BaseConverter):
def convert(
self,
file_path: Path,
file_path: Union[Path,str],
meta: Optional[Dict[str, str]] = None,
remove_numeric_tables: Optional[bool] = None,
valid_languages: Optional[List[str]] = None,
@ -101,6 +101,7 @@ class ImageToTextConverter(BaseConverter):
not one of the valid languages, then it might likely be encoding error resulting
in garbled text.
"""
file_path = Path(file_path)
image = Image.open(file_path)
pages = self._image_to_text(image)
if remove_numeric_tables is None: