我有一个python应用程序,它使用tesseract来检测扫描图像中的复选框,在我的本地机器上工作得非常好,但当我将代码与python-tesseract buildpack一起推送到Bluemix时,它无法生成输出文件,这意味着在Bluemix上没有检测到tesseract。
应用:
- 路径:。
记忆:512M
实例:1 域名:mybluemix.net
名称:edge-noise-detector-bluemix
主机:edge-noise-detector-bluemix
disk_quota:1024M
buildpack:https://github.com/LeoKotschenreuther/python-tesseract-buildpack.git
烧瓶
numpy的
枕头== 4.1.1
pycparser
pyOpenSSL
pyparsing
pytesseract
蟒蛇,dateutil
蟒蛇,swiftclient
pytz
PyWavelets
scikit图像
SciPy的
请求
matplotlib == 1.4.3
OpenCV的 - 蟒蛇
cf_deployment_tracker
超正方体
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上完成这项工作。 有没有人得到python与tesseract在Bluemix上工作?请帮忙。
答案 0 :(得分:1)
IBM Cloud为您提供了运行应用程序的多种可能性。 Cloud Foundry Runtimes就是其中之一,但在你的情况下看起来并不合适。每当你有一个需要安装的依赖项时,你需要创建自定义buildpack,这可能是一个相当复杂的任务。 (https://docs.cloudfoundry.org/buildpacks/custom.html) 有没有听说过Docker / Kubernetes?如果您有许多应用程序依赖项(如您的案例中的tesseract),我建议您创建一个Kubernetes环境来构建您的应用程序! 看看这些资源:https://hub.docker.com/r/tesseractshadow/tesseract4re/ https://console.bluemix.net/docs/containers/container_index.html#container_index