Commit 5ff3248a by 杨林龙

优化界面交互

1 parent f9211910
import os
import shutil
from flask import request, Blueprint
import requests
from flaskr.biz.identify_service import IdentifyService
......@@ -34,13 +35,18 @@ def identify():
return a
@classfication_bp.route("/identifyLocal", methods=["POST"])
def identifyLocal():
local_img_path = request.get_json()["img_path"]
@classfication_bp.route("/upload", methods=["POST"])
def upload():
file = request.files["file"] # 获取上传的文件
file.save("uploads/" + file.filename) # 保存文件到指定路径
local_img_path = "./uploads/" + file.filename
print("local_img_path===", local_img_path)
(a, b) = ImageClassificationService("data/modelFile/my_model03.h5").doClassfication(
local_img_path
)
# 预测完以后删除文件
print("预测完以后删除文件" + local_img_path)
os.remove(local_img_path)
print(a, b)
return a
......
......@@ -5,8 +5,15 @@
<title>车牌识别系统</title>
</head>
<body>
<h1>车牌识别</h1>
<form method="POST" enctype="multipart/form-data" action="http://127.0.0.1:5000/upload">
文件:<input type="file" name="file" />
<input type="submit" value="上传云端识别" />
</form>
<h1>图片识别</h1>
<form method="POST" enctype="multipart/form-data" action="http://127.0.0.1:5000/classfication/upload">
文件:<input type="file" name="file" />
<input type="submit" value="上传云端识别" />
</form>
</html>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!