Spaces:
Runtime error
Runtime error
| from fastapi import APIRouter, UploadFile, File | |
| from src.controllers import prediction_controller | |
| from pydantic import BaseModel | |
| from typing import Dict | |
| class SinglePredictionRequest(BaseModel): | |
| __root__: Dict[str, float] | |
| router = APIRouter(prefix="/predict", tags=["predict"]) | |
| def predict_from_csv(file: UploadFile = File(...)): | |
| """ | |
| Route pour uploader un CSV, le prétraiter et obtenir les prédictions. | |
| """ | |
| return prediction_controller.global_prediction_on_csv(file) | |
| def single_prediction(req: SinglePredictionRequest): | |
| return prediction_controller.single_prediction(req.__root__) | |