gdleds commited on
Commit
2a14360
·
1 Parent(s): e76cfc1

modif app explication

Browse files
Files changed (1) hide show
  1. app.py +46 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from fastapi import FastAPI, HTTPException
2
  from pydantic import BaseModel
 
3
  import pandas as pd
4
  import boto3
5
  import joblib
@@ -8,11 +9,53 @@ import io
8
 
9
  # === Initialisation FastAPI ===
10
  app = FastAPI(
11
- title="Getaround API - Prédiction de prix",
12
- description="API simple pour prédire le prix journalier d'une location 🚗",
13
- version="1.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  )
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # === Schéma attendu pour l'entrée ===
17
  class InputData(BaseModel):
18
  model_key: str
 
1
  from fastapi import FastAPI, HTTPException
2
  from pydantic import BaseModel
3
+ from typing import Literal
4
  import pandas as pd
5
  import boto3
6
  import joblib
 
9
 
10
  # === Initialisation FastAPI ===
11
  app = FastAPI(
12
+ title="🚗 Getaround Price Prediction API",
13
+ description="""
14
+ ### 🎯 Description
15
+ Cette API prédit le **prix de location journalier** d’un véhicule.
16
+
17
+ 👉 Pour certaines colonnes (`model_key`, `fuel`, `car_type`, `paint_color`), **choisir une valeur parmi les critères listés**.
18
+ 👉 Pour les autres options (`private_parking_available`, `has_gps`, etc.), utiliser **True pour Oui** et **False pour Non**.
19
+
20
+ Exemple :
21
+ ```json
22
+ {
23
+ "model_key": "Audi",
24
+ "mileage": 100000,
25
+ "engine_power": 120,
26
+ "fuel": "diesel",
27
+ "paint_color": "black",
28
+ "car_type": "estate",
29
+ "private_parking_available": true,
30
+ "has_gps": true,
31
+ "has_air_conditioning": false,
32
+ "automatic_car": false,
33
+ "has_getaround_connect": true,
34
+ "has_speed_regulator": false,
35
+ "winter_tires": true
36
+ }
37
+ """,
38
+ version="1.0"
39
  )
40
 
41
+ ModelKey = Literal[
42
+ "Citroën", "Peugeot", "PGO", "Renault", "Audi", "BMW", "Ford", "Mercedes",
43
+ "Opel", "Porsche", "Volkswagen", "KIA Motors", "Alfa Romeo", "Ferrari", "Fiat",
44
+ "Lamborghini", "Maserati", "Lexus", "Honda", "Mazda", "Mini", "Mitsubishi",
45
+ "Nissan", "SEAT", "Subaru", "Suzuki", "Toyota", "Yamaha"
46
+ ]
47
+
48
+ Fuel = Literal["diesel", "petrol", "hybrid_petrol", "electro"]
49
+
50
+ CarType = Literal[
51
+ "convertible", "coupe", "estate", "hatchback", "sedan", "subcompact", "suv", "van"
52
+ ]
53
+
54
+ PaintColor = Literal[
55
+ "black", "grey", "white", "red", "silver", "blue", "orange",
56
+ "beige", "brown", "green"
57
+ ]
58
+
59
  # === Schéma attendu pour l'entrée ===
60
  class InputData(BaseModel):
61
  model_key: str