Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import cv2
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
model = torch.hub.load('ultralytics/yolov8', 'custom', path='best.pt')
|
| 6 |
+
|
| 7 |
+
def detect(image):
|
| 8 |
+
results = model(image)
|
| 9 |
+
return results.render()[0]
|
| 10 |
+
|
| 11 |
+
gr.Interface(
|
| 12 |
+
fn=detect,
|
| 13 |
+
inputs=gr.Image(type="numpy"),
|
| 14 |
+
outputs=gr.Image(type="numpy"),
|
| 15 |
+
title="Vehicle Detection"
|
| 16 |
+
).launch()
|