Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-027
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-27
2021-027
Commits
3c2e8731
Commit
3c2e8731
authored
Oct 22, 2021
by
Rifana F.N.F_IT16141902
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2e8b7b6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
38 deletions
+0
-38
CarPark/api.py
CarPark/api.py
+0
-38
No files found.
CarPark/api.py
deleted
100644 → 0
View file @
2e8b7b6d
import
cv2
import
flask
import
torch
import
werkzeug
app
=
flask
.
Flask
(
__name__
)
model
=
torch
.
hub
.
load
(
'ultralytics/yolov5'
,
'custom'
,
path
=
'model/best.pt'
)
@
app
.
route
(
'/test'
,
methods
=
[
'GET'
,
'POST'
])
def
test
():
img
=
cv2
.
imread
(
'upload/2012-12-15_08_10_03_jpg.rf.79ed952a7195142a1e08028ac5938d1a.jpg'
)
results
=
model
(
img
)
return
results
.
pandas
()
.
xyxy
[
0
]
.
to_json
(
orient
=
'records'
)
@
app
.
route
(
'/upload'
,
methods
=
[
'POST'
])
def
upload
():
imagefile
=
flask
.
request
.
files
[
'image'
]
filename
=
werkzeug
.
utils
.
secure_filename
(
imagefile
.
filename
)
print
(
"
\n
Received image File name : "
+
imagefile
.
filename
)
imagefile
.
save
(
'Upload/'
+
filename
)
img
=
cv2
.
imread
(
'Upload/'
+
filename
)
results
=
model
(
img
)
return
results
.
pandas
()
.
xyxy
[
0
]
.
to_json
(
orient
=
'records'
)
@
app
.
route
(
'/cctv'
,
methods
=
[
'GET'
,
'POST'
])
def
cctv
():
cam
=
cv2
.
VideoCapture
(
0
)
img
=
cam
.
read
()[
1
]
cv2
.
imwrite
(
'Cctv/snap.jpg'
,
img
)
results
=
model
(
img
)
return
results
.
pandas
()
.
xyxy
[
0
]
.
to_json
(
orient
=
'records'
)
app
.
run
(
host
=
"0.0.0.0"
,
port
=
5000
,
debug
=
True
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment