Download app.py from avraux/co2prediction: direct link, hf CLI and curl.
- Browser
- Download file 560 Bytes
-
https://huggingface.co/avraux/co2prediction/resolve/main/app.py
- Command line
-
hf download hf://avraux/co2prediction/app.py
-
curl -L -o app.py https://huggingface.co/avraux/co2prediction/resolve/main/app.py
560 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from inference import preprocess_and_predict | |
| # Définir l'API | |
| app = FastAPI() | |
| # Définir un modèle d'entrée | |
| class InputData(BaseModel): | |
| puiss_admin_98: int | |
| conso_urb: float | |
| conso_exurb: float | |
| masse_ordma_max: float | |
| marque: str | |
| typ_boite: str | |
| champ_v9 : str | |
| carrosserie: str | |
| gamme: str | |
| # Endpoint pour prédiction | |
| def predict(data: InputData): | |
| input_json = data.dict() | |
| result = preprocess_and_predict(input_json) | |
| return result | |