Spaces:
Runtime error
Runtime error
| from fastapi import APIRouter | |
| from schema.schemas import PredictionInput, PredictionOutput | |
| from service.classifier import load_model, predict | |
| router = APIRouter(prefix="/predict", tags=["Prediction"]) | |
| # Load the model once | |
| model, vectorizer = load_model() | |
| def make_prediction(input_data: PredictionInput): | |
| prediction = predict(input_data.text, model, vectorizer) | |
| return {"prediction": prediction} | |