Spaces:
Sleeping
Sleeping
Commit ·
eb736ea
1
Parent(s): 74838d4
presenttaion
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +48 -1
- test.ipynb +69 -0
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -43,7 +43,54 @@ import pandas as pd
|
|
| 43 |
import joblib
|
| 44 |
import os
|
| 45 |
|
| 46 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
@app.get("/")
|
| 49 |
def root():
|
|
|
|
| 43 |
import joblib
|
| 44 |
import os
|
| 45 |
|
| 46 |
+
app = FastAPI(
|
| 47 |
+
title="API Getaround",
|
| 48 |
+
description="""
|
| 49 |
+
|
| 50 |
+
Bienvenue sur l'API de prédiction de prix de location de véhicules GetAround !
|
| 51 |
+
|
| 52 |
+
Grâce à notre modèle prédictif entraîné sur les données du partenaire GetAround, vous pouvez estimer rapidement le prix journalier d'un véhicule en fournissant ses caractéristiques.
|
| 53 |
+
|
| 54 |
+
📌 **Règles pour certaines colonnes :**
|
| 55 |
+
|
| 56 |
+
- **model_key** : choisissez parmi les marques listées :
|
| 57 |
+
"Citroën", "Peugeot", "PGO", "Renault", "Audi", "BMW", "Ford", "Mercedes",
|
| 58 |
+
"Opel", "Porsche", "Volkswagen", "KIA Motors", "Alfa Romeo", "Ferrari",
|
| 59 |
+
"Fiat", "Lamborghini", "Maserati", "Lexus", "Honda", "Mazda", "Mini",
|
| 60 |
+
"Mitsubishi", "Nissan", "SEAT", "Subaru", "Suzuki", "Toyota", "Yamaha".
|
| 61 |
+
|
| 62 |
+
- **fuel** : "diesel", "petrol", "hybrid_petrol", "electro".
|
| 63 |
+
|
| 64 |
+
- **paint_color** : "black", "grey", "white", "red", "silver", "blue",
|
| 65 |
+
"orange", "beige", "brown", "green".
|
| 66 |
+
|
| 67 |
+
- **car_type** : "convertible", "coupe", "estate", "hatchback", "sedan",
|
| 68 |
+
"subcompact", "suv", "van".
|
| 69 |
+
|
| 70 |
+
Pour les autres options (private_parking_available, has_gps, etc.), utilisez **true** pour Oui et **false** pour Non.
|
| 71 |
+
|
| 72 |
+
EXEMPLE :
|
| 73 |
+
|
| 74 |
+
```json
|
| 75 |
+
{
|
| 76 |
+
"car_brand": "Renault",
|
| 77 |
+
"mileage": 50000,
|
| 78 |
+
"engine_power": 120,
|
| 79 |
+
"fuel": "diesel",
|
| 80 |
+
"paint_color": "white",
|
| 81 |
+
"car_type": "estate",
|
| 82 |
+
"private_parking_available": false,
|
| 83 |
+
"has_gps": true,
|
| 84 |
+
"has_air_conditioning": false,
|
| 85 |
+
"automatic_car": false,
|
| 86 |
+
"has_getaround_connect": false,
|
| 87 |
+
"has_speed_regulator": false,
|
| 88 |
+
"winter_tires": true
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
""",
|
| 92 |
+
version="1.0"
|
| 93 |
+
)
|
| 94 |
|
| 95 |
@app.get("/")
|
| 96 |
def root():
|
test.ipynb
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 5,
|
| 6 |
+
"id": "551a90a7",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"name": "stdout",
|
| 11 |
+
"output_type": "stream",
|
| 12 |
+
"text": [
|
| 13 |
+
"200\n",
|
| 14 |
+
"{'prediction': [142.45413208007812]}\n"
|
| 15 |
+
]
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"source": [
|
| 19 |
+
"import pandas as pd\n",
|
| 20 |
+
"import requests\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"\n",
|
| 23 |
+
"API_URL = \"https://nath13huggingface-getaround-api.hf.space/predict\"\n",
|
| 24 |
+
"\n",
|
| 25 |
+
"data = {\n",
|
| 26 |
+
" \"mileage\": 50000,\n",
|
| 27 |
+
" \"engine_power\": 110,\n",
|
| 28 |
+
" \"model_key\": \"BMW\",\n",
|
| 29 |
+
" \"fuel\": \"diesel\",\n",
|
| 30 |
+
" \"paint_color\": \"white\",\n",
|
| 31 |
+
" \"car_type\": \"van\",\n",
|
| 32 |
+
" \"private_parking_available\": True,\n",
|
| 33 |
+
" \"has_gps\": True,\n",
|
| 34 |
+
" \"has_air_conditioning\": True,\n",
|
| 35 |
+
" \"automatic_car\": True,\n",
|
| 36 |
+
" \"has_getaround_connect\": True,\n",
|
| 37 |
+
" \"has_speed_regulator\": True,\n",
|
| 38 |
+
" \"winter_tires\": True\n",
|
| 39 |
+
"}\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"response = requests.post(API_URL, json=data)\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"print(response.status_code)\n",
|
| 44 |
+
"print(response.json())\n"
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"metadata": {
|
| 49 |
+
"kernelspec": {
|
| 50 |
+
"display_name": "ml_deployment",
|
| 51 |
+
"language": "python",
|
| 52 |
+
"name": "python3"
|
| 53 |
+
},
|
| 54 |
+
"language_info": {
|
| 55 |
+
"codemirror_mode": {
|
| 56 |
+
"name": "ipython",
|
| 57 |
+
"version": 3
|
| 58 |
+
},
|
| 59 |
+
"file_extension": ".py",
|
| 60 |
+
"mimetype": "text/x-python",
|
| 61 |
+
"name": "python",
|
| 62 |
+
"nbconvert_exporter": "python",
|
| 63 |
+
"pygments_lexer": "ipython3",
|
| 64 |
+
"version": "3.11.13"
|
| 65 |
+
}
|
| 66 |
+
},
|
| 67 |
+
"nbformat": 4,
|
| 68 |
+
"nbformat_minor": 5
|
| 69 |
+
}
|