我有一个 python 应用程序,它使用 tesseract 检测扫描图像中的复选框,在我的本地机器上运行良好,但是当我将代码连同 python-tesseract buildpack 一起推送到 Bluemix 时,它无法生成输出文件,这意味着 tesseract 不是在 Bluemix 上被检测到。
这是我的 manifest.yml:
应用程序:
- 路径:.
内存:512M
实例:1 个
域:mybluemix.net
名称:edge-noise-detector-bluemix
主机:edge-noise-detector-bluemix
disk_quota:1024M
buildpack:https://github.com/LeoKotschenreuther/python-tesseract-buildpack。混帐
这是我的 requirements.txt:
Flask
numpy
Pillow==4.1.1
pycparser
pyOpenSSL
pyparsing
pytesseract
python-dateutil
python-swiftclient
pytz
PyWavelets
scikit-image
scipy
requests
matplotlib==1.4.3
opencv-python
cf_deployment_tracker
tesseract
这是来自 Bluemix 的日志:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "server.py", line 217, in predict_square_checkboxes
ImgOcr = image_hocr_class.ocr_hocr('temporary.png')
File "/home/vcap/app/src/image_hocr_class.py", line 39, in __init__
self.HTMLTree = xml.etree.ElementTree.parse(self.HOCRFileName).getroot()
File "/app/.heroku/python/lib/python3.6/xml/etree/ElementTree.py", line 1196, in parse
tree.parse(source, parser)
File "/app/.heroku/python/lib/python3.6/xml/etree/ElementTree.py", line 586, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'images/8e297b93a39f1e08a490f72c8db53bf0.hocr'
这通常发生在 pytesseract 无法找到 tesseract 的路径时。不知道如何在 Bluemix 上完成这项工作。有没有人在 Bluemix 上使用 tesseract 获得 python?请帮忙。