Dricz commited on
Commit
be96225
1 Parent(s): 5d64bc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -30,10 +30,14 @@ def image_preprocess(image):
30
  model = YOLO('best (1).pt')
31
 
32
  def response(image):
33
- res = Image.fromarray(image)
34
- im_rgb = model(res)
 
 
 
 
35
  # im_rgb = Image.fromarray(im_rgb)
36
- return np.array(im_rgb)
37
 
38
  iface = gr.Interface(fn=response, inputs="image", outputs="image")
39
  iface.launch()
 
30
  model = YOLO('best (1).pt')
31
 
32
  def response(image):
33
+ results = model(image)
34
+ for i, r in enumerate(results):
35
+ # Plot results image
36
+ im_bgr = r.plot() # BGR-order numpy array
37
+ im_rgb = im_bgr[..., ::-1] # Convert BGR to RGB
38
+
39
  # im_rgb = Image.fromarray(im_rgb)
40
+ return im_rgb
41
 
42
  iface = gr.Interface(fn=response, inputs="image", outputs="image")
43
  iface.launch()