set model_repo to use env variable
Browse files
app.py
CHANGED
|
@@ -5,9 +5,10 @@ from predict_dept_model import DepartmentPredictor
|
|
| 5 |
from contextlib import asynccontextmanager
|
| 6 |
from response_schema import ClassificationOutput, TextInput
|
| 7 |
from huggingface_hub import HfApi
|
|
|
|
| 8 |
|
| 9 |
# Define the model repository ID
|
| 10 |
-
model_repo = "
|
| 11 |
|
| 12 |
# hf api
|
| 13 |
api = HfApi()
|
|
@@ -19,7 +20,7 @@ api = HfApi()
|
|
| 19 |
async def lifespan(app: FastAPI):
|
| 20 |
# Load the model
|
| 21 |
global predictor
|
| 22 |
-
predictor = DepartmentPredictor()
|
| 23 |
yield
|
| 24 |
|
| 25 |
|
|
|
|
| 5 |
from contextlib import asynccontextmanager
|
| 6 |
from response_schema import ClassificationOutput, TextInput
|
| 7 |
from huggingface_hub import HfApi
|
| 8 |
+
import os
|
| 9 |
|
| 10 |
# Define the model repository ID
|
| 11 |
+
model_repo = os.getenv("MODEL_REPO")
|
| 12 |
|
| 13 |
# hf api
|
| 14 |
api = HfApi()
|
|
|
|
| 20 |
async def lifespan(app: FastAPI):
|
| 21 |
# Load the model
|
| 22 |
global predictor
|
| 23 |
+
predictor = DepartmentPredictor(model_repo= model_repo)
|
| 24 |
yield
|
| 25 |
|
| 26 |
|