ocr web server 教程跑不起来
Created by: myfjdthink
这个是官方教程 https://github.com/PaddlePaddle/Serving/tree/develop/python/examples/ocr
按照教程安装好依赖,执行
python3 rec_web_server.py
得到报错
cannot import name 'GetRotateCropImage' from 'paddle_serving_app.reader'
刚刚看了源码,这个错误是因为没有及时更新 paddle_serving_app 包,教程出来了,代码没跟上。。。。。。
rec_web_server.py 实际上不需要依赖 paddle_serving_app 这些东西,清除不需要的依赖后,可以跑起来了。
模拟发送请求
python3 rec_web_client.py
得到以下错误:
2020-07-20 18:16:56,126-ERROR: Exception on /ocr/prediction [POST] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1945, in full_dispatch_request self.try_trigger_before_first_request_functions() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1993, in try_trigger_before_first_request_functions func() File "/usr/local/lib/python3.7/site-packages/paddle_serving_server/web_service.py", line 108, in init self._launch_web_service() File "/usr/local/lib/python3.7/site-packages/paddle_serving_server/web_service.py", line 70, in _launch_web_service self.client = Client() File "/usr/local/lib/python3.7/site-packages/paddle_serving_client/init.py", line 136, in init from .serving_client import PredictorRes ImportError: dlopen(/usr/local/lib/python3.7/site-packages/paddle_serving_client/serving_client.so, 2): no suitable image found. Did find: /usr/local/lib/python3.7/site-packages/paddle_serving_client/serving_client.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 /usr/local/lib/python3.7/site-packages/paddle_serving_client/serving_client.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 2020-07-20 18:16:56,127-INFO: 127.0.0.1 - - [20/Jul/2020 18:16:56] "POST /ocr/prediction HTTP/1.1" 500 -