syedatasneem1 commited on
Commit
f494c3e
1 Parent(s): ad26017

Upload 5 files

Browse files
Files changed (5) hide show
  1. image_1.jpg +0 -0
  2. image_2.jpg +0 -0
  3. image_3.jpg +0 -0
  4. requirements.txt +5 -0
  5. yolov8_model.py +22 -0
image_1.jpg ADDED
image_2.jpg ADDED
image_3.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ torch
3
+ Pillow
4
+ ultralytics
5
+ opencv-python
yolov8_model.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from ultralytics import YOLO
3
+ from PIL import Image
4
+
5
+ det_model = YOLO("yolov8n.pt")
6
+
7
+ def detect_objects(image):
8
+ results = det_model(image)
9
+ det_img = results[0].plot()
10
+ return det_img
11
+
12
+
13
+ iface = gr.Interface(
14
+ detect_objects,
15
+ inputs=gr.Image(type="pil"),
16
+ outputs=gr.Image(type="pil"),
17
+ title="YOLOv8 Object Detection",
18
+ description="Upload an image to detect objects and see them boxed",
19
+ examples=['./image_1.jpg', './image_2.jpg', './image_3.jpg']
20
+ )
21
+
22
+ iface.launch()