Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
my_flask_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5ff3248a
authored
Dec 11, 2023
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化界面交互
1 parent
f9211910
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
flaskr/controller/__pycache__/image_classfication_controller.cpython-39.pyc
flaskr/controller/image_classfication_controller.py
templates/index.html
flaskr/controller/__pycache__/image_classfication_controller.cpython-39.pyc
View file @
5ff3248
No preview for this file type
flaskr/controller/image_classfication_controller.py
View file @
5ff3248
import
os
import
os
import
shutil
from
flask
import
request
,
Blueprint
from
flask
import
request
,
Blueprint
import
requests
import
requests
from
flaskr.biz.identify_service
import
IdentifyService
from
flaskr.biz.identify_service
import
IdentifyService
...
@@ -34,13 +35,18 @@ def identify():
...
@@ -34,13 +35,18 @@ def identify():
return
a
return
a
@classfication_bp.route
(
"/identifyLocal"
,
methods
=
[
"POST"
])
@classfication_bp.route
(
"/upload"
,
methods
=
[
"POST"
])
def
identifyLocal
():
def
upload
():
local_img_path
=
request
.
get_json
()[
"img_path"
]
file
=
request
.
files
[
"file"
]
# 获取上传的文件
file
.
save
(
"uploads/"
+
file
.
filename
)
# 保存文件到指定路径
local_img_path
=
"./uploads/"
+
file
.
filename
print
(
"local_img_path==="
,
local_img_path
)
print
(
"local_img_path==="
,
local_img_path
)
(
a
,
b
)
=
ImageClassificationService
(
"data/modelFile/my_model03.h5"
)
.
doClassfication
(
(
a
,
b
)
=
ImageClassificationService
(
"data/modelFile/my_model03.h5"
)
.
doClassfication
(
local_img_path
local_img_path
)
)
# 预测完以后删除文件
print
(
"预测完以后删除文件"
+
local_img_path
)
os
.
remove
(
local_img_path
)
print
(
a
,
b
)
print
(
a
,
b
)
return
a
return
a
...
...
templates/index.html
View file @
5ff3248
...
@@ -5,8 +5,15 @@
...
@@ -5,8 +5,15 @@
<title>
车牌识别系统
</title>
<title>
车牌识别系统
</title>
</head>
</head>
<body>
<body>
<h1>
车牌识别
</h1>
<form
method=
"POST"
enctype=
"multipart/form-data"
action=
"http://127.0.0.1:5000/upload"
>
<form
method=
"POST"
enctype=
"multipart/form-data"
action=
"http://127.0.0.1:5000/upload"
>
文件:
<input
type=
"file"
name=
"file"
/>
文件:
<input
type=
"file"
name=
"file"
/>
<input
type=
"submit"
value=
"上传云端识别"
/>
<input
type=
"submit"
value=
"上传云端识别"
/>
</form>
</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>
</html>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment