e1250 commited on
Commit
0363778
·
1 Parent(s): 7521897
Files changed (1) hide show
  1. main.py +4 -7
main.py CHANGED
@@ -9,7 +9,6 @@ from api.routers import health
9
  from infra.logger_structlog import StructLogger
10
 
11
  from contextlib import asynccontextmanager
12
- import os
13
  import mlflow
14
  import torch
15
  import redis.asyncio as aioredis
@@ -18,9 +17,9 @@ import dagshub
18
  from fastapi import FastAPI
19
 
20
 
21
- settings = AppConfig()
22
- if settings.dagshub_user_token:
23
- os.environ["DAGSHUB_USER_TOKEN"] = settings.dagshub_user_token
24
 
25
 
26
  @asynccontextmanager
@@ -28,7 +27,7 @@ async def lifespan(app: FastAPI):
28
  """
29
  This is on_event("startup") new alternative, Make sure you load models here.
30
  """
31
-
32
  logger = StructLogger(settings=settings)
33
  # Using this way to can store data. it is acts as a dict which holds instances
34
  app.state.logger = logger
@@ -41,14 +40,12 @@ async def lifespan(app: FastAPI):
41
  detection_model_path = hf_fetch_model(
42
  repo_id="Ultralytics/YOLO26",
43
  filename=settings.yolo.model_name,
44
- cache_dir=settings.hf_cache_dir,
45
  )
46
  app.state.detection_model = YOLO_Detector(detection_model_path)
47
 
48
  depth_model_path = hf_fetch_model(
49
  repo_id="depth-anything/Depth-Anything-V2-Small",
50
  filename=settings.depth.model_name,
51
- cache_dir=settings.hf_cache_dir,
52
  )
53
  app.state.depth_model = DepthAnything(
54
  encoder=settings.depth.encoder,
 
9
  from infra.logger_structlog import StructLogger
10
 
11
  from contextlib import asynccontextmanager
 
12
  import mlflow
13
  import torch
14
  import redis.asyncio as aioredis
 
17
  from fastapi import FastAPI
18
 
19
 
20
+ # settings = AppConfig()
21
+ # if settings.dagshub_user_token:
22
+ # os.environ["DAGSHUB_USER_TOKEN"] = settings.dagshub_user_token
23
 
24
 
25
  @asynccontextmanager
 
27
  """
28
  This is on_event("startup") new alternative, Make sure you load models here.
29
  """
30
+ settings = AppConfig()
31
  logger = StructLogger(settings=settings)
32
  # Using this way to can store data. it is acts as a dict which holds instances
33
  app.state.logger = logger
 
40
  detection_model_path = hf_fetch_model(
41
  repo_id="Ultralytics/YOLO26",
42
  filename=settings.yolo.model_name,
 
43
  )
44
  app.state.detection_model = YOLO_Detector(detection_model_path)
45
 
46
  depth_model_path = hf_fetch_model(
47
  repo_id="depth-anything/Depth-Anything-V2-Small",
48
  filename=settings.depth.model_name,
 
49
  )
50
  app.state.depth_model = DepthAnything(
51
  encoder=settings.depth.encoder,