Spaces:
Sleeping
Sleeping
Commit
·
f760b79
1
Parent(s):
e28f634
feat: add yolov8 detection code
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from ultralytics import YOLO
|
|
|
3 |
|
4 |
model = YOLO("./models/yolov8-best.pt")
|
5 |
classNames = ["license-plate", "vehicle"]
|
@@ -13,6 +14,7 @@ image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
|
13 |
if image is not None:
|
14 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
15 |
img = image.read()
|
16 |
-
|
|
|
17 |
json_results = results[0].tojson()
|
18 |
st.write(json_results)
|
|
|
1 |
import streamlit as st
|
2 |
from ultralytics import YOLO
|
3 |
+
from PIL import Image
|
4 |
|
5 |
model = YOLO("./models/yolov8-best.pt")
|
6 |
classNames = ["license-plate", "vehicle"]
|
|
|
14 |
if image is not None:
|
15 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
16 |
img = image.read()
|
17 |
+
img = Image.open(img)
|
18 |
+
results = model.predict(img, conf=0.5)
|
19 |
json_results = results[0].tojson()
|
20 |
st.write(json_results)
|