Spaces:
Sleeping
Sleeping
Commit
·
7e49696
1
Parent(s):
5c6194d
frat: add yolov8 detection code
Browse files- app.py +16 -2
- requirements.txt +5 -0
app.py
CHANGED
@@ -1,4 +1,18 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from ultralytics import YOLO
|
3 |
|
4 |
+
model = YOLO("models/best.pt")
|
5 |
+
classNames = ["license-plate", "vehicle"]
|
6 |
+
|
7 |
+
st.title("Number Plate and Vehicle Detection using YOLOv8")
|
8 |
+
|
9 |
+
st.write("This is a web app to detect number plates and vehicles in images using YOLOv8.")
|
10 |
+
|
11 |
+
image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
12 |
+
|
13 |
+
if image is not None:
|
14 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
15 |
+
img = image.read()
|
16 |
+
results = model.predict(image, conf=0.5)
|
17 |
+
json_results = results[0].tojson()
|
18 |
+
st.write(json_results)
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
opencv-python==4.8.0.74
|
2 |
+
Pillow==10.0.0
|
3 |
+
torch==2.0.1
|
4 |
+
torchvision==0.15.2
|
5 |
+
ultralytics==8.0.147
|