fix(TesseractOcrCliModel): Send the stderr to devnull to avoid poluting the console with messages from tesseract cmd

Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
This commit is contained in:
Nikos Livathinos 2024-10-10 17:19:44 +02:00
parent 9e0a6ffd41
commit 4a0c9be576

View File

@ -1,7 +1,7 @@
import io import io
import logging import logging
import tempfile import tempfile
from subprocess import PIPE, Popen from subprocess import DEVNULL, PIPE, Popen
from typing import Iterable, Tuple from typing import Iterable, Tuple
import pandas as pd import pandas as pd
@ -81,7 +81,7 @@ class TesseractOcrCliModel(BaseOcrModel):
cmd += [ifilename, "stdout", "tsv"] cmd += [ifilename, "stdout", "tsv"]
_log.info("command: {}".format(" ".join(cmd))) _log.info("command: {}".format(" ".join(cmd)))
proc = Popen(cmd, stdout=PIPE) proc = Popen(cmd, stdout=PIPE, stderr=DEVNULL)
output, _ = proc.communicate() output, _ = proc.communicate()
# _log.info(output) # _log.info(output)