Dricz commited on
Commit
3fe3c0c
·
verified ·
1 Parent(s): ec20b40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -6,10 +6,14 @@ from ultralytics import YOLO
6
  model = YOLO('best (1).pt')
7
 
8
  def response(image):
9
- img = Image.fromarray(image)
10
- results = model(img)
11
  # Plot results image
12
-
 
 
 
 
 
13
  return results
14
 
15
  iface = gr.Interface(fn=response, inputs="image", outputs="image")
 
6
  model = YOLO('best (1).pt')
7
 
8
  def response(image):
9
+ for i, r in enumerate(results):
 
10
  # Plot results image
11
+ im_bgr = r.plot() # BGR-order numpy array
12
+ im_rgb = im_bgr[..., ::-1] # Convert BGR to RGB
13
+ plt.figure(figsize=(10, 10))
14
+ plt.imshow(im_rgb)
15
+ plt.axis('off')
16
+ plt.show()
17
  return results
18
 
19
  iface = gr.Interface(fn=response, inputs="image", outputs="image")