HinaCortus's picture
Upload 3 files
14d1947
raw
history blame
530 Bytes
from fastapi import FastAPI
from pydantic import BaseModel
from app.model.model import predict_pipeline
from app.model.model import __version__ as model_version
app = FastAPI()
class TextIn(BaseModel):
text: str
class PredictionOut(BaseModel):
language: str
@app.get("/")
def home():
return {"health_check": "OK", "model_version": model_version}
@app.post("/predict", response_model=PredictionOut)
def predict(payload: TextIn):
language = predict_pipeline(payload.text)
return {"language": language}