From 73bcd41b5df4d8f8c16461ba4058cd13bc990180 Mon Sep 17 00:00:00 2001 From: Joachim Hummel Date: Tue, 2 Jun 2026 11:37:56 +0200 Subject: [PATCH] model.names statt model.model.names (kein None-Attribut-Warnung) Type-Checker sah model.model als evtl. None. YOLO bietet die Klassen- namen direkt ueber model.names an (identischer Inhalt verifiziert). Co-Authored-By: Claude Opus 4.8 (1M context) --- app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 6ae0c59..9c31e4b 100644 --- a/app.py +++ b/app.py @@ -165,7 +165,7 @@ app.config["MAX_CONTENT_LENGTH"] = 200 * 1024 * 1024 # 200MB Upload-Limit # Globales Modell fuer den Video-Upload-Pfad (per Request). model = YOLO("yolo11s.pt") -names = model.model.names +names = model.names VEHICLE_CLASSES = {"car", "truck", "bus", "motorcycle"} ALLOWED_EXTENSIONS = {"mp4", "mov", "avi", "mkv"} @@ -554,7 +554,7 @@ class WebcamGrabber: def _ensure_model(self): if self.model is None: self.model = YOLO(WEBCAM_MODEL) - self.names = self.model.model.names + self.names = self.model.names def _publish(self, jpeg: bytes): with self.frame_cond: