mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-06 03:57:19 +00:00
* satisfy mypy * add import
This commit is contained in:
parent
6093bf9ff6
commit
e4c3c3d423
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user