Skip to content

Commit

Permalink
Merge pull request szad670401#258 from zhupengfeivip/master
Browse files Browse the repository at this point in the history
增加dockerfile文件,完善webapi.py功能
  • Loading branch information
Jinkham authored May 26, 2020
2 parents 1810690 + 03f5dbf commit a507ff8
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 8 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

10 changes: 4 additions & 6 deletions WebAPI.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#coding=utf-8
from flask import Flask, render_template, request
from werkzeug import secure_filename
from werkzeug.utils import secure_filename

import cv2
import numpy as np

#导入opencv

from hyperlpr import pipline
from hyperlpr_py3 import pipline
#导入车牌识别库


Expand Down Expand Up @@ -43,18 +43,16 @@ def upload_file():
#保存请求上来的文件
t0 = time.time()
res = recognize("./images_rec/"+secure_filename(f.filename))
print "识别时间",time.time() - t0
print("识别时间",time.time() - t0)
return res
#返回识别结果

# return 'file uploaded successfully'
return render_template('upload.html')



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 指定端口

4 changes: 2 additions & 2 deletions hyperlpr_py3/pipline.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ def RecognizePlateJson(image):
res_json["w"] = int(rect[2])
res_json["h"] = int(rect[3])
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)



Expand Down
53 changes: 53 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a507ff8

Please sign in to comment.