P-ID_Detection / app.py
brian25's picture
Update app.py
68bdcf9 verified
raw
history blame
678 Bytes
import gradio as gr
from ultralytics import YOLO
model = YOLO("best.pt")
def greet(detection):
results = model(detection) # return a list of Results objects
for result in results:
boxes = result.boxes # Boxes object for bounding box outputs
masks = result.masks # Masks object for segmentation masks outputs
keypoints = result.keypoints # Keypoints object for pose outputs
probs = result.probs # Probs object for classification outputs
obb = result.obb # Oriented boxes object for OBB outputs
result.show() # display to screen
return result.show()
demo = gr.Interface(fn=greet, inputs="image", outputs="image")
demo.launch()