sort_tracker / app.py
broadfield-dev's picture
Update app.py
8480cc9 verified
raw
history blame contribute delete
641 Bytes
import supervision as sv
from trackers import SORTTracker
from inference import get_model
import gradio as gr
tracker = SORTTracker()
model = get_model(model_id="yolov11m-640")
annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER)
def callback(frame, _):
result = model.infer(frame)[0]
detections = sv.Detections.from_inference(result)
detections = tracker.update(detections)
return annotator.annotate(frame, detections, labels=detections.tracker_id)
with gr.Blocks() as app:
inp_vid = gr.Video()
brn = gr.Button()
out_vid = gr.Video()
btn.click(sv.process_video,inp_vid,out_vid)
app.launch()