Spaces:
Sleeping
Sleeping
OnlyBiggg
commited on
Commit
·
ea3086a
1
Parent(s):
cea87ce
fix
Browse files- app/dialogflow/api/router.py +3 -1
- core/conf.py +4 -0
- core/registrar.py +2 -0
- utils/life_span.py +0 -1
app/dialogflow/api/router.py
CHANGED
|
@@ -5,6 +5,8 @@ from fastapi import APIRouter
|
|
| 5 |
from app.dialogflow.api.v1.dialogflow import router as dialogflow_router
|
| 6 |
from core.conf import settings
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
v1.include_router(dialogflow_router)
|
|
|
|
| 5 |
from app.dialogflow.api.v1.dialogflow import router as dialogflow_router
|
| 6 |
from core.conf import settings
|
| 7 |
|
| 8 |
+
from utils.life_span import lifespan
|
| 9 |
+
|
| 10 |
+
v1 = APIRouter(prefix=settings.FASTAPI_API_V1_PATH, lifespan=lifespan)
|
| 11 |
|
| 12 |
v1.include_router(dialogflow_router)
|
core/conf.py
CHANGED
|
@@ -30,6 +30,10 @@ class Settings(BaseSettings):
|
|
| 30 |
# DATABASE_PORT: int
|
| 31 |
# DATABASE_USER: str
|
| 32 |
# DATABASE_PASSWORD: str
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# FastAPI
|
| 35 |
FASTAPI_API_V1_PATH: str = '/api/v1'
|
|
|
|
| 30 |
# DATABASE_PORT: int
|
| 31 |
# DATABASE_USER: str
|
| 32 |
# DATABASE_PASSWORD: str
|
| 33 |
+
|
| 34 |
+
# MODEl NER
|
| 35 |
+
NER_MODEL_NAME: str = 'ner'
|
| 36 |
+
TASK_NAME: str = 'ner'
|
| 37 |
|
| 38 |
# FastAPI
|
| 39 |
FASTAPI_API_V1_PATH: str = '/api/v1'
|
core/registrar.py
CHANGED
|
@@ -19,6 +19,7 @@ from core.path_conf import STATIC_DIR, UPLOAD_DIR
|
|
| 19 |
from utils.health_check import ensure_unique_route_names, http_limit_callback
|
| 20 |
from utils.openapi import simplify_operation_ids
|
| 21 |
from utils.serializers import MsgSpecJSONResponse
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
# @asynccontextmanager
|
|
@@ -53,6 +54,7 @@ def register_app() -> FastAPI:
|
|
| 53 |
redoc_url=settings.FASTAPI_REDOC_URL,
|
| 54 |
openapi_url=settings.FASTAPI_OPENAPI_URL,
|
| 55 |
default_response_class=MsgSpecJSONResponse,
|
|
|
|
| 56 |
)
|
| 57 |
|
| 58 |
register_logger()
|
|
|
|
| 19 |
from utils.health_check import ensure_unique_route_names, http_limit_callback
|
| 20 |
from utils.openapi import simplify_operation_ids
|
| 21 |
from utils.serializers import MsgSpecJSONResponse
|
| 22 |
+
from utils.life_span import lifespan
|
| 23 |
|
| 24 |
|
| 25 |
# @asynccontextmanager
|
|
|
|
| 54 |
redoc_url=settings.FASTAPI_REDOC_URL,
|
| 55 |
openapi_url=settings.FASTAPI_OPENAPI_URL,
|
| 56 |
default_response_class=MsgSpecJSONResponse,
|
| 57 |
+
lifespan=lifespan
|
| 58 |
)
|
| 59 |
|
| 60 |
register_logger()
|
utils/life_span.py
CHANGED
|
@@ -2,7 +2,6 @@ from contextlib import asynccontextmanager
|
|
| 2 |
|
| 3 |
from fastapi import FastAPI
|
| 4 |
|
| 5 |
-
|
| 6 |
@asynccontextmanager
|
| 7 |
async def lifespan(app: FastAPI):
|
| 8 |
# Load the ML model
|
|
|
|
| 2 |
|
| 3 |
from fastapi import FastAPI
|
| 4 |
|
|
|
|
| 5 |
@asynccontextmanager
|
| 6 |
async def lifespan(app: FastAPI):
|
| 7 |
# Load the ML model
|