Spaces:
Runtime error
Runtime error
main
Browse files
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
import supervision as sv
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
model = YOLO("best.pt")
|
| 8 |
+
bbox_anno = sv.BoundingBoxAnnotator(thickness=2)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def model_detection(img):
|
| 12 |
+
result = model(img)
|
| 13 |
+
detection = sv.Detections.from_ultralytics(result[0])
|
| 14 |
+
frame = bbox_anno.annotate(detections=detection,scene=img)
|
| 15 |
+
return frame
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
if __name__ =="__main__":
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
web= gr.Interface(model_detection,gr.Image(),outputs="image")
|
| 25 |
+
web.launch(share=True)
|
| 26 |
+
# main()
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2466cc6334f7d1b70fa33e46a8d1ce405cd9ed99fb97ebd9bd95ba718e30d894
|
| 3 |
+
size 22554137
|