Srikesh commited on
Commit
ed8ca5d
·
verified ·
1 Parent(s): 2875277

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import gradio as gr
3
+ import torch
4
+
5
+
6
+ model = YOLO("best.pt")
7
+
8
+
9
+ def predict(image):
10
+ results = model(image)
11
+ return results[0].plot()
12
+
13
+
14
+ demo = gr.Interface(
15
+ fn=predict,
16
+ inputs=gr.Image(type="filepath", label="Upload Image"),
17
+ outputs=gr.Image(label="Detection Result"),
18
+ title="YOLO Object Detection",
19
+ description="Upload an image and let YOLO detect objects!"
20
+ )
21
+
22
+ demo.launch()