Fix: got data from backend

This commit is contained in:
ziesorx 2025-09-13 01:00:49 +07:00
parent 42a8325faf
commit 086ba0e4d3
4 changed files with 107 additions and 12 deletions

9
app.py
View file

@ -5,6 +5,7 @@ This replaces the monolithic app.py with a clean, maintainable structure
using dependency injection and singleton managers.
"""
import logging
import os
from contextlib import asynccontextmanager
from fastapi import FastAPI, WebSocket, HTTPException
from fastapi.responses import Response
@ -91,6 +92,14 @@ async def lifespan(app: FastAPI):
camera_manager.clear_all()
pipeline_manager.clear_all()
# Clear model cache files on disk
import shutil
from detector_worker.core.config import MODELS_DIR
if os.path.exists(MODELS_DIR):
logger.info(f"Clearing model cache directory: {MODELS_DIR}")
shutil.rmtree(MODELS_DIR)
logger.info("Model cache directory cleared")
# Clear dependency container singletons
container.get_container().clear_singletons()