File size: 494 Bytes
22a85f1
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Here exists function to use instead of using app.state directly in the main.py
from fastapi.requests import HTTPConnection

def get_detection_model(request: HTTPConnection):
    return request.app.state.detection_model

def get_depth_model(request: HTTPConnection):
    return request.app.state.depth_model

def get_safety_detection_model(request: HTTPConnection):
    return request.app.state.safety_detection_model

def get_redis(request: HTTPConnection):
    return request.app.state.redis