Spaces:
Runtime error
Runtime error
fixed ai to fetch from hf, fixed dashboard assets
Browse files
main.py
CHANGED
|
@@ -11,6 +11,7 @@ from backend.api.routers import health
|
|
| 11 |
from contextlib import asynccontextmanager
|
| 12 |
from infra.logger_structlog import StructLogger
|
| 13 |
import asyncio
|
|
|
|
| 14 |
|
| 15 |
@asynccontextmanager
|
| 16 |
async def lifespan(app: FastAPI):
|
|
@@ -29,9 +30,14 @@ async def lifespan(app: FastAPI):
|
|
| 29 |
|
| 30 |
# Using this way to can store data. it is acts as a dict which holds instances
|
| 31 |
app.state.detection_model = YOLO_Detector(settings.yolo.model_path)
|
| 32 |
-
app.state.safety_detection_model = YOLO_Detector(settings.security_detector.model_path)
|
| 33 |
app.state.depth_model = DepthAnything(encoder=settings.depth.encoder, depth_model_path=settings.depth.model_path, DEVICE="cuda")
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
app.state.logger = logger
|
| 36 |
app.state.settings = settings
|
| 37 |
# Each camera should have its tracker to be able to work fine.
|
|
|
|
| 11 |
from contextlib import asynccontextmanager
|
| 12 |
from infra.logger_structlog import StructLogger
|
| 13 |
import asyncio
|
| 14 |
+
from huggingface_hub import hf_hub_download
|
| 15 |
|
| 16 |
@asynccontextmanager
|
| 17 |
async def lifespan(app: FastAPI):
|
|
|
|
| 30 |
|
| 31 |
# Using this way to can store data. it is acts as a dict which holds instances
|
| 32 |
app.state.detection_model = YOLO_Detector(settings.yolo.model_path)
|
|
|
|
| 33 |
app.state.depth_model = DepthAnything(encoder=settings.depth.encoder, depth_model_path=settings.depth.model_path, DEVICE="cuda")
|
| 34 |
|
| 35 |
+
# safety_detection_path = hg_hub_download(
|
| 36 |
+
# repo_id="e1250/safety_detection",
|
| 37 |
+
# filename="yolo_smoke_fire.pt",
|
| 38 |
+
# )
|
| 39 |
+
app.state.safety_detection_model = YOLO_Detector(settings.security_detector.model_path)
|
| 40 |
+
|
| 41 |
app.state.logger = logger
|
| 42 |
app.state.settings = settings
|
| 43 |
# Each camera should have its tracker to be able to work fine.
|