File size: 647 Bytes
b488bef
47ee765
428e3e7
8762d1f
 
2863de0
8762d1f
 
 
 
428e3e7
58e9978
8762d1f
 
 
 
428e3e7
 
47ee765
8762d1f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from ultralytics import YOLO

# Load YOLO model
model = YOLO("Suspicious_Activities_nano.pt")

# Define a function to predict and return the result
def predict_suspicious_activity(image):
    results = model.predict(source=image, show=True, conf=0.6)
    return results.pandas().xywh[0].to_dict()  # Adjust as per your model output structure

# Create Gradio interface
interface = gr.Interface(
    fn=predict_suspicious_activity,
    inputs=gr.inputs.Image(type="pil"),  # Input type for uploading images
    outputs="json"  # Output type (you can adjust this based on your needs)
)

# Launch the interface
interface.launch()