pytesseract + heroku
написал бота на python (телеграм бот) который может получить текст из картинки. Загрузил на Heroku.
Добавил buildpack (https://github.com/heroku/heroku-buildpack-apt)
И добавил Config Vars (TESSDATA_PREFIX = ./.apt/usr/share/tesseract-ocr/4.00/tessdata)
Так же добавил файл Aptfile
tesseract-ocr
tesseract-ocr-eng
tesseract-ocr-rus
Вот основная часть кода:
file_info = bot.get_file(message.photo[-1].file_id)
downloaded_file = bot.download_file(file_info.file_path)
file_name = (f'img_tt_{message.chat.id}_{int(time.time())}.jpg')
with open(file_name, 'wb') as new_file:
new_file.write(downloaded_file)
pytesseract.pytesseract.tesseract_cmd = '/app/.apt/usr/bin/tesseract'
text = pytesseract.image_to_string(Image.open(file_name))
bot.reply_to(message, f'<b>text in photo:</b>' + '\n' + '\n' + f'<code>{str(text)}</code>', parse_mode='html')
При работе получаю ошибку:
(127, '/app/.apt/usr/bin/tesseract: error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such file or directory')
Как исправить это? Или есть другие способы получения текста из фото ? Самое главное что-бы бот мог получать текст из фото. Буду благодарен за любую помощь!