Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,6 +19,12 @@ from ultralytics import YOLO
|
|
19 |
|
20 |
# Constants
|
21 |
ASSETS_DIR = Path(__file__).parent / "assets"
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
DEMO_VIDEOS = {
|
23 |
"One Person": ASSETS_DIR / "one-by-one-person-detection.mp4",
|
24 |
"Store Aisle": ASSETS_DIR / "store-aisle-detection.mp4",
|
@@ -459,15 +465,24 @@ class PeopleDetectionApp:
|
|
459 |
with st.sidebar:
|
460 |
st.header("Settings")
|
461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
# Model selection
|
463 |
-
|
464 |
"Select detection model",
|
465 |
-
options=
|
466 |
-
"yolov8n.pt", # Nano model (smallest)
|
467 |
-
],
|
468 |
index=0,
|
469 |
)
|
470 |
|
|
|
|
|
|
|
471 |
# Detection threshold
|
472 |
detection_threshold = st.slider(
|
473 |
"Detection threshold",
|
|
|
19 |
|
20 |
# Constants
|
21 |
ASSETS_DIR = Path(__file__).parent / "assets"
|
22 |
+
# Add custom model paths
|
23 |
+
MODELS_DIR = Path(__file__).parent.parent.parent
|
24 |
+
YOLO11N_MODEL = MODELS_DIR / "yolo11n_results" / "best.pt"
|
25 |
+
YOLO11S_MODEL = MODELS_DIR / "yolo11s_results" / "best.pt"
|
26 |
+
YOLO11M_MODEL = MODELS_DIR / "yolo11m_results" / "best.pt"
|
27 |
+
|
28 |
DEMO_VIDEOS = {
|
29 |
"One Person": ASSETS_DIR / "one-by-one-person-detection.mp4",
|
30 |
"Store Aisle": ASSETS_DIR / "store-aisle-detection.mp4",
|
|
|
465 |
with st.sidebar:
|
466 |
st.header("Settings")
|
467 |
|
468 |
+
# Create a mapping for readable model names
|
469 |
+
model_options = {
|
470 |
+
"YOLOv8n (Nano)": "yolov8n.pt",
|
471 |
+
"YOLO11n (Custom)": str(YOLO11N_MODEL),
|
472 |
+
"YOLO11s (Custom)": str(YOLO11S_MODEL),
|
473 |
+
"YOLO11m (Custom)": str(YOLO11M_MODEL),
|
474 |
+
}
|
475 |
+
|
476 |
# Model selection
|
477 |
+
model_display_name = st.selectbox(
|
478 |
"Select detection model",
|
479 |
+
options=list(model_options.keys()),
|
|
|
|
|
480 |
index=0,
|
481 |
)
|
482 |
|
483 |
+
# Get the actual model path from the display name
|
484 |
+
model_name = model_options[model_display_name]
|
485 |
+
|
486 |
# Detection threshold
|
487 |
detection_threshold = st.slider(
|
488 |
"Detection threshold",
|