增加dockerfile文件,完善webapi.py功能pull/4/head
| @@ -0,0 +1,11 @@ | |||||
| #基于的基础镜像 | |||||
| FROM python:3.6 | |||||
| #代码添加到code文件夹,后面可以通过进入容器中看的 | |||||
| ADD ./ /code | |||||
| # 设置code文件夹是工作目录 | |||||
| WORKDIR /code | |||||
| # 安装支持 | |||||
| RUN pip install -r requirement.txt -i https://pypi.tuna.tsinghua.edu.cn/simple | |||||
| #当容器启动时,使用python3执行指定路径的py脚本 | |||||
| CMD ["python", "/code/WebAPI.py"] | |||||
| @@ -1,13 +1,13 @@ | |||||
| #coding=utf-8 | #coding=utf-8 | ||||
| from flask import Flask, render_template, request | from flask import Flask, render_template, request | ||||
| from werkzeug import secure_filename | |||||
| from werkzeug.utils import secure_filename | |||||
| import cv2 | import cv2 | ||||
| import numpy as np | import numpy as np | ||||
| #导入opencv | #导入opencv | ||||
| from hyperlpr import pipline | |||||
| from hyperlpr_py3 import pipline | |||||
| #导入车牌识别库 | #导入车牌识别库 | ||||
| @@ -43,7 +43,7 @@ def upload_file(): | |||||
| #保存请求上来的文件 | #保存请求上来的文件 | ||||
| t0 = time.time() | t0 = time.time() | ||||
| res = recognize("./images_rec/"+secure_filename(f.filename)) | res = recognize("./images_rec/"+secure_filename(f.filename)) | ||||
| print "识别时间",time.time() - t0 | |||||
| print("识别时间",time.time() - t0) | |||||
| return res | return res | ||||
| #返回识别结果 | #返回识别结果 | ||||
| @@ -51,10 +51,8 @@ def upload_file(): | |||||
| return render_template('upload.html') | return render_template('upload.html') | ||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||
| #入口函数 | #入口函数 | ||||
| app.run("0.0.0.0",port=8000) | |||||
| app.run("0.0.0.0", port=8000, threaded=False, debug=False) | |||||
| #运行app 指定IP 指定端口 | #运行app 指定IP 指定端口 | ||||
| @@ -145,9 +145,9 @@ def RecognizePlateJson(image): | |||||
| res_json["w"] = int(rect[2]) | res_json["w"] = int(rect[2]) | ||||
| res_json["h"] = int(rect[3]) | res_json["h"] = int(rect[3]) | ||||
| jsons.append(res_json) | jsons.append(res_json) | ||||
| print(json.dumps(jsons,ensure_ascii=False,encoding="gb2312")) | |||||
| print(json.dumps(jsons,ensure_ascii=False)) | |||||
| return json.dumps(jsons,ensure_ascii=False,encoding="gb2312") | |||||
| return json.dumps(jsons,ensure_ascii=False) | |||||
| @@ -0,0 +1,53 @@ | |||||
| absl-py==0.9.0 | |||||
| alembic==1.4.2 | |||||
| astor==0.8.1 | |||||
| click==7.1.1 | |||||
| cycler==0.10.0 | |||||
| decorator==4.4.2 | |||||
| Flask==1.0 | |||||
| Flask-Migrate==2.5.3 | |||||
| Flask-MySQLdb==0.2.0 | |||||
| Flask-Script==2.0.6 | |||||
| Flask-Session==0.3.1 | |||||
| Flask-SQLAlchemy==2.4.1 | |||||
| gast==0.3.3 | |||||
| grpcio==1.27.2 | |||||
| h5py==2.10.0 | |||||
| imageio==2.8.0 | |||||
| itsdangerous==1.1.0 | |||||
| Jinja2==2.11.1 | |||||
| joblib==0.14.1 | |||||
| Keras==2.1.1 | |||||
| Keras-Applications==1.0.8 | |||||
| Keras-Preprocessing==1.1.0 | |||||
| kiwisolver==1.1.0 | |||||
| Mako==1.1.2 | |||||
| Markdown==3.2.1 | |||||
| MarkupSafe==1.1.1 | |||||
| matplotlib==3.2.1 | |||||
| mock==4.0.2 | |||||
| mysqlclient==1.4.6 | |||||
| networkx==2.4 | |||||
| numpy==1.17.4 | |||||
| opencv-contrib-python==3.4.2.16 | |||||
| opencv-python==3.4.2.16 | |||||
| Pillow==7.0.0 | |||||
| protobuf==3.11.3 | |||||
| pyparsing==2.4.6 | |||||
| python-dateutil==2.8.1 | |||||
| python-editor==1.0.4 | |||||
| PyWavelets==1.1.1 | |||||
| PyYAML==5.3.1 | |||||
| redis==3.4.1 | |||||
| scikit-image==0.16.2 | |||||
| scikit-learn==0.22.2.post1 | |||||
| scipy==1.4.1 | |||||
| six==1.14.0 | |||||
| sklearn==0.0 | |||||
| SQLAlchemy==1.3.15 | |||||
| tensorboard==1.13.1 | |||||
| tensorflow==1.15.2 | |||||
| tensorflow-estimator==1.13.0 | |||||
| termcolor==1.1.0 | |||||
| Theano==1.0.4 | |||||
| Werkzeug==1.0.0 | |||||