Delwin Mathew
commited on
Commit
·
89ec2fe
1
Parent(s):
f5c57f1
use lifespan
Browse files
app.py
CHANGED
|
@@ -3,8 +3,6 @@ from pydantic import BaseModel
|
|
| 3 |
import spacy
|
| 4 |
from contextlib import asynccontextmanager
|
| 5 |
|
| 6 |
-
app = FastAPI()
|
| 7 |
-
|
| 8 |
# Global variable to store the model
|
| 9 |
nlp = None
|
| 10 |
|
|
@@ -15,6 +13,7 @@ async def lifespan(app: FastAPI):
|
|
| 15 |
yield
|
| 16 |
await cleanup()
|
| 17 |
|
|
|
|
| 18 |
|
| 19 |
async def load_model():
|
| 20 |
"""
|
|
|
|
| 3 |
import spacy
|
| 4 |
from contextlib import asynccontextmanager
|
| 5 |
|
|
|
|
|
|
|
| 6 |
# Global variable to store the model
|
| 7 |
nlp = None
|
| 8 |
|
|
|
|
| 13 |
yield
|
| 14 |
await cleanup()
|
| 15 |
|
| 16 |
+
app = FastAPI(lifespan=lifespan)
|
| 17 |
|
| 18 |
async def load_model():
|
| 19 |
"""
|