File size: 823 Bytes
2542be6
0c1ad60
2542be6
 
1495fa6
bbfbf5e
 
 
 
 
ac8afe6
bbfbf5e
 
 
 
 
 
 
2542be6
bbfbf5e
114cd96
42f800d
2542be6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from fastapi import FastAPI
# from core.init_nlp import initialize_nlp
import logging
from api.endpoints import location

# @asynccontextmanager
# async def lifespan(app: FastAPI):
#     # initialize_nlp()
#     print("Initializing NER model and tokenizer")
#     logging.info("Initializing NER model and tokenizer")
    
#     app.tokenizer = AutoTokenizer.from_pretrained("ml6team/bert-base-uncased-city-country-ner")
#     app.model = AutoModelForTokenClassification.from_pretrained("ml6team/bert-base-uncased-city-country-ner")
#     app.nlp = pipeline('ner', model=app.model, tokenizer=app.tokenizer, aggregation_strategy="simple")
#     g.set_default("ner_model", ner_model)    
#     yield
#     del sentiment_model
#     g.cleanup()

app = FastAPI()

app.include_router(location.router, prefix="/location/api/v1")