UNDO-project / app.py
jnap's picture
Initial commit UNDO-CCTV detector
409a81b unverified
raw
history blame
691 Bytes
import gradio as gr
from ultralytics import YOLO
# Load trained YOLOv8 model
model = YOLO('samples/best.pt')
def detect_objects(image):
"""
Run inference on the uploaded image.
:param image: Input image for object detection.
:return: Image with bounding boxes and labels.
"""
results = model.predict(image)
return results[0].plot() # Plots the bounding boxes on the image
# Gradio interface
demo = gr.Interface(
fn=detect_objects,
inputs=gr.Image(type="pil"),
outputs="image",
title="YOLOv8 CCTV Detection",
description="Upload an image to detect CCTV on public spaces using a YOLOv8 model."
)
if __name__ == "__main__":
demo.launch()