Spaces:
Sleeping
Sleeping
Initial commit UNDO-CCTV detector
Browse files- app.py +26 -0
- best.pt +3 -0
- requirements.txt +16 -0
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
|
| 4 |
+
# Load trained YOLOv8 model
|
| 5 |
+
model = YOLO('samples/best.pt')
|
| 6 |
+
|
| 7 |
+
def detect_objects(image):
|
| 8 |
+
"""
|
| 9 |
+
Run inference on the uploaded image.
|
| 10 |
+
:param image: Input image for object detection.
|
| 11 |
+
:return: Image with bounding boxes and labels.
|
| 12 |
+
"""
|
| 13 |
+
results = model.predict(image)
|
| 14 |
+
return results[0].plot() # Plots the bounding boxes on the image
|
| 15 |
+
|
| 16 |
+
# Gradio interface
|
| 17 |
+
demo = gr.Interface(
|
| 18 |
+
fn=detect_objects,
|
| 19 |
+
inputs=gr.Image(type="pil"),
|
| 20 |
+
outputs="image",
|
| 21 |
+
title="YOLOv8 CCTV Detection",
|
| 22 |
+
description="Upload an image to detect CCTV on public spaces using a YOLOv8 model."
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
demo.launch()
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:531b88acde02d73fd4df1e727294d4bd786a42f040d52ed4aa7ab16b23c502cd
|
| 3 |
+
size 6231715
|
requirements.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pillow-heif==0.21.0
|
| 2 |
+
pillow==11.1.0
|
| 3 |
+
loguru==0.7.3
|
| 4 |
+
playwright==1.47.0
|
| 5 |
+
pandas==2.2.3
|
| 6 |
+
torch==2.7.0
|
| 7 |
+
torchvision==0.22.0
|
| 8 |
+
scikit-learn==1.6.1
|
| 9 |
+
ultralytics==8.3.74
|
| 10 |
+
pyyaml==6.0.2
|
| 11 |
+
sphinx==8.2.3
|
| 12 |
+
sphinx-rtd-theme==3.0.2
|
| 13 |
+
gradio==5.29.0
|
| 14 |
+
|
| 15 |
+
ruff==0.9.10
|
| 16 |
+
pre-commit==3.8.0
|