alibidaran commited on
Commit
ce00d99
·
verified ·
1 Parent(s): 2395100

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -9,17 +9,19 @@ model = YOLO('Dental_model.pt') # Replace 'yolov8n.pt' with your model file if
9
  pic_files=glob.glob('*.jpg')
10
  names=model.model.names
11
  def detect_objects(image):
12
- image1=image.copy()
13
  results = model.predict(image)
14
- whole=results[0].plot()
15
- classes=results[0].boxes.cls.cpu().tolist()
16
- boxes=results[0].boxes.xyxy.cpu()
17
  annotator = Annotator(image, line_width=3)
18
- annotator1=Annotator(image1, line_width=3)
19
- for box,cls in zip(boxes,classes):
 
20
  annotator.box_label(box, label=names[int(cls)], color=colors(int(cls)))
21
  annotator1.box_label(box, label=None, color=colors(int(cls)))
22
- return Image.fromarray(annotator.result()),Image.fromarray(annotator1.result()),None
 
 
23
 
24
  # Gradio Interface
25
  title = "YOLOv8 Object Detection"
 
9
  pic_files=glob.glob('*.jpg')
10
  names=model.model.names
11
  def detect_objects(image):
12
+ image1 = image.copy()
13
  results = model.predict(image)
14
+ classes = results[0].boxes.cls.cpu().tolist()
15
+ boxes = results[0].boxes.xyxy.cpu()
 
16
  annotator = Annotator(image, line_width=3)
17
+ annotator1 = Annotator(image1, line_width=3)
18
+
19
+ for box, cls in zip(boxes, classes):
20
  annotator.box_label(box, label=names[int(cls)], color=colors(int(cls)))
21
  annotator1.box_label(box, label=None, color=colors(int(cls)))
22
+
23
+ return Image.fromarray(annotator.result()), Image.fromarray(annotator1.result())
24
+
25
 
26
  # Gradio Interface
27
  title = "YOLOv8 Object Detection"