|
import gradio as gr |
|
from ultralytics import YOLO |
|
from PIL import Image |
|
|
|
|
|
model = YOLO("Suspicious_Activities_nano.pt") |
|
|
|
|
|
def predict_suspicious_activity(image): |
|
results = model.predict(source=image, show=False, conf=0.6) |
|
results_img = results[0].plot() |
|
return Image.fromarray(results_img) |
|
|
|
|
|
|
|
interface = gr.Interface( |
|
fn=predict_suspicious_activity, |
|
inputs=gr.Image(type="pil"), |
|
outputs=gr.Image(type="pil"), |
|
|
|
|
|
|
|
|
|
|
|
|
|
title="Suspicious Activity Detection with YOLO", |
|
description="Upload an image to detect suspicious activities.", |
|
) |
|
|
|
|
|
interface.launch(share=True) |