jsakshi commited on
Commit
484f522
·
verified ·
1 Parent(s): 8796cb7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,16 +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()
 
1
  import gradio as gr
2
+ from ultralytics import YOLO
3
  import cv2
 
4
 
5
+ model = YOLO("last.pt")
6
 
7
+ def predict(image):
8
+ results = model(image)[0]
9
+ return results.plot()
10
 
11
  gr.Interface(
12
+ fn=predict,
13
  inputs=gr.Image(type="numpy"),
14
  outputs=gr.Image(type="numpy"),
15
+ title="Vehicle Detection App"
16
  ).launch()