Spaces:
Sleeping
Sleeping
maj app
Browse files
app.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, Body, Request
|
| 2 |
from fastapi.responses import JSONResponse, RedirectResponse
|
| 3 |
from fastapi.exceptions import RequestValidationError
|
| 4 |
from pydantic import BaseModel, Field
|
| 5 |
from typing import Literal
|
| 6 |
-
|
| 7 |
-
import joblib
|
| 8 |
-
import uvicorn
|
| 9 |
|
| 10 |
# Charger le modèle
|
| 11 |
model = joblib.load("get_around_v1.pkl")
|
|
@@ -39,7 +40,23 @@ class CarData(BaseModel):
|
|
| 39 |
# Initialisation FastAPI
|
| 40 |
app = FastAPI(
|
| 41 |
title="GetAround Prediction API",
|
| 42 |
-
description="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
version="1.0"
|
| 44 |
)
|
| 45 |
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import joblib
|
| 3 |
+
import uvicorn
|
| 4 |
from fastapi import FastAPI, Body, Request
|
| 5 |
from fastapi.responses import JSONResponse, RedirectResponse
|
| 6 |
from fastapi.exceptions import RequestValidationError
|
| 7 |
from pydantic import BaseModel, Field
|
| 8 |
from typing import Literal
|
| 9 |
+
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Charger le modèle
|
| 12 |
model = joblib.load("get_around_v1.pkl")
|
|
|
|
| 40 |
# Initialisation FastAPI
|
| 41 |
app = FastAPI(
|
| 42 |
title="GetAround Prediction API",
|
| 43 |
+
description="""
|
| 44 |
+
🎯 Cette API prédit le prix de location journalier d’un véhicule.
|
| 45 |
+
|
| 46 |
+
👉 Pour certaines colonnes (car_brand, fuel, car_type, paint_color), choisir une valeur parmi les critères listés, à savoir :
|
| 47 |
+
|
| 48 |
+
- car_brand : "Citroën", "Peugeot", "PGO", "Renault", "Audi", "BMW", "Ford", "Mercedes",
|
| 49 |
+
"Opel", "Porsche", "Volkswagen", "KIA Motors", "Alfa Romeo", "Ferrari",
|
| 50 |
+
"Fiat", "Lamborghini", "Maserati", "Lexus", "Honda", "Mazda", "Mini",
|
| 51 |
+
"Mitsubishi", "Nissan", "SEAT", "Subaru", "Suzuki", "Toyota", "Yamaha".
|
| 52 |
+
|
| 53 |
+
- fuel : "diesel", "petrol", "hybrid_petrol", "electro".
|
| 54 |
+
|
| 55 |
+
- paint_color : "black", "grey", "white", "red", "silver", "blue",
|
| 56 |
+
"orange", "beige", "brown", "green"
|
| 57 |
+
|
| 58 |
+
👉 Pour les autres options (private_parking_available, has_gps, etc.), utiliser true pour Oui et false pour Non.
|
| 59 |
+
""",
|
| 60 |
version="1.0"
|
| 61 |
)
|
| 62 |
|