waste_hackathon / app.py
saumilyajj's picture
main
b723cb0 verified
raw
history blame contribute delete
526 Bytes
import cv2
from ultralytics import YOLO
import supervision as sv
import gradio as gr
model = YOLO("best.pt")
bbox_anno = sv.BoundingBoxAnnotator(thickness=2)
def model_detection(img):
result = model(img)
detection = sv.Detections.from_ultralytics(result[0])
frame = bbox_anno.annotate(detections=detection,scene=img)
return frame
if __name__ =="__main__":
web= gr.Interface(model_detection,gr.Image(),outputs="image")
web.launch(share=True)
# main()