Spaces:
Runtime error
Runtime error
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 | |
def home(): | |
return {"health_check": "OK", "model_version": model_version} | |
def predict(payload: TextIn): | |
language = predict_pipeline(payload.text) | |
return {"language": language} |