JF1999 commited on
Commit
9470839
·
verified ·
1 Parent(s): 7854b49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,11 +4,11 @@ from PIL import Image
4
  from ultralytics import YOLO
5
  model=YOLO("yolov8s.pt")
6
  def predict_Image(img):
7
- if img.model!="RGB":
8
  img=img.convert("RGB")
9
  res=model.predict(source=img,conf=0.25)
10
  im_array=res[0].plot()
11
  pil_img=Image.fromarray(im_array[...,::-1])
12
  return pil_img
13
  iface=gr.Interface(fn=predict_Image,inputs=gr.Image(type="pil"),outputs="image",examples=["/input_img/ds.jpg"],title="Detection of EBIKE on SparseRCNN",description="upload a picture to detect EBIKE")
14
- iface.launch()
 
4
  from ultralytics import YOLO
5
  model=YOLO("yolov8s.pt")
6
  def predict_Image(img):
7
+ if img.mode!="RGB":
8
  img=img.convert("RGB")
9
  res=model.predict(source=img,conf=0.25)
10
  im_array=res[0].plot()
11
  pil_img=Image.fromarray(im_array[...,::-1])
12
  return pil_img
13
  iface=gr.Interface(fn=predict_Image,inputs=gr.Image(type="pil"),outputs="image",examples=["/input_img/ds.jpg"],title="Detection of EBIKE on SparseRCNN",description="upload a picture to detect EBIKE")
14
+ iface.launch(share=True)