Spaces:
Sleeping
Sleeping
madamanastasia commited on
Commit ·
e2b371d
1
Parent(s): 5615b8f
update docs with correct URLs and price
Browse files
docs.html
CHANGED
|
@@ -1,212 +1,103 @@
|
|
| 1 |
-
|
| 2 |
-
<!doctype html>
|
| 3 |
<html lang="fr">
|
| 4 |
<head>
|
| 5 |
-
<meta charset="
|
| 6 |
-
<meta name="viewport" content="width=device-width,initial-scale=1"
|
| 7 |
-
<title>Getaround — Documentation API Pricing</title>
|
| 8 |
<style>
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
--err: #991b1b;
|
| 22 |
-
}
|
| 23 |
-
body {
|
| 24 |
-
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
|
| 25 |
-
margin: 32px;
|
| 26 |
-
max-width: 980px;
|
| 27 |
-
color: var(--text);
|
| 28 |
-
background: var(--bg);
|
| 29 |
-
line-height: 1.55;
|
| 30 |
-
}
|
| 31 |
-
h1 { margin: 0 0 6px 0; font-size: 28px; }
|
| 32 |
-
.subtitle { margin: 0 0 18px 0; color: var(--muted); }
|
| 33 |
-
.pill {
|
| 34 |
-
display: inline-block;
|
| 35 |
-
font-size: 12px;
|
| 36 |
-
padding: 2px 10px;
|
| 37 |
-
border-radius: 999px;
|
| 38 |
-
background: var(--soft);
|
| 39 |
-
border: 1px solid var(--border);
|
| 40 |
-
color: var(--muted);
|
| 41 |
-
vertical-align: middle;
|
| 42 |
-
margin-left: 8px;
|
| 43 |
-
}
|
| 44 |
-
.card {
|
| 45 |
-
border: 1px solid var(--border);
|
| 46 |
-
border-radius: 14px;
|
| 47 |
-
padding: 16px;
|
| 48 |
-
margin: 14px 0;
|
| 49 |
-
background: #fff;
|
| 50 |
-
}
|
| 51 |
-
.grid {
|
| 52 |
-
display: grid;
|
| 53 |
-
grid-template-columns: 1fr;
|
| 54 |
-
gap: 12px;
|
| 55 |
-
}
|
| 56 |
-
@media (min-width: 900px) {
|
| 57 |
-
.grid { grid-template-columns: 1fr 1fr; }
|
| 58 |
-
}
|
| 59 |
-
code {
|
| 60 |
-
background: #f3f4f6;
|
| 61 |
-
padding: 2px 6px;
|
| 62 |
-
border-radius: 6px;
|
| 63 |
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
| 64 |
-
font-size: 0.95em;
|
| 65 |
-
}
|
| 66 |
-
pre {
|
| 67 |
-
background: var(--codebg);
|
| 68 |
-
color: var(--codefg);
|
| 69 |
-
padding: 12px 14px;
|
| 70 |
-
border-radius: 12px;
|
| 71 |
-
overflow-x: auto;
|
| 72 |
-
border: 1px solid rgba(255,255,255,0.08);
|
| 73 |
-
}
|
| 74 |
-
pre code {
|
| 75 |
-
background: transparent;
|
| 76 |
-
padding: 0;
|
| 77 |
-
border-radius: 0;
|
| 78 |
-
font-size: 13px;
|
| 79 |
-
}
|
| 80 |
-
.note {
|
| 81 |
-
background: var(--note);
|
| 82 |
-
padding: 12px 14px;
|
| 83 |
-
border-left: 4px solid var(--note-border);
|
| 84 |
-
border-radius: 10px;
|
| 85 |
-
margin: 10px 0;
|
| 86 |
-
}
|
| 87 |
-
.kv { margin: 8px 0 0 0; padding: 0; list-style: none; }
|
| 88 |
-
.kv li { margin: 6px 0; }
|
| 89 |
-
.kv b { display: inline-block; min-width: 130px; }
|
| 90 |
-
.status { font-weight: 700; }
|
| 91 |
-
.status.ok { color: var(--ok); }
|
| 92 |
-
.status.warn { color: var(--warn); }
|
| 93 |
-
.status.err { color: var(--err); }
|
| 94 |
-
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
|
| 95 |
-
a { color: #1d4ed8; text-decoration: none; }
|
| 96 |
-
a:hover { text-decoration: underline; }
|
| 97 |
-
ul { margin: 8px 0 0 18px; }
|
| 98 |
</style>
|
| 99 |
</head>
|
| 100 |
-
|
| 101 |
<body>
|
| 102 |
-
<h1>🚗 Getaround — Documentation de l’API Pricing</h1>
|
| 103 |
-
<p class="subtitle">
|
| 104 |
-
Documentation minimale requise, accessible via <code>/docs</code> : description de chaque endpoint (méthode, entrée, sortie, exemples).
|
| 105 |
-
</p>
|
| 106 |
-
|
| 107 |
-
<div class="card">
|
| 108 |
-
<h2>Vue d’ensemble</h2>
|
| 109 |
-
<p>Cette API expose un modèle de Machine Learning qui prédit <code>rental_price_per_day</code> en fonction des caractéristiques du véhicule.</p>
|
| 110 |
-
<ul>
|
| 111 |
-
<li><code>GET /</code> — Page d’accueil (HTML)</li>
|
| 112 |
-
<li><code>GET /health</code> — Healthcheck (JSON)</li>
|
| 113 |
-
<li><code>POST /predict</code> — Prédiction (JSON)</li>
|
| 114 |
-
<li><code>GET /docs</code> — Documentation (HTML)</li>
|
| 115 |
-
</ul>
|
| 116 |
-
</div>
|
| 117 |
-
|
| 118 |
-
<div class="card">
|
| 119 |
-
<h2><code>GET /</code><span class="pill">HTML</span></h2>
|
| 120 |
-
<ul class="kv">
|
| 121 |
-
<li><b>Méthode</b> GET</li>
|
| 122 |
-
<li><b>Entrée</b> Aucune</li>
|
| 123 |
-
<li><b>Sortie</b> Page HTML listant les endpoints disponibles</li>
|
| 124 |
-
</ul>
|
| 125 |
-
<p><b>Exemple :</b></p>
|
| 126 |
-
<pre><code>curl -s http://127.0.0.1:8000/</code></pre>
|
| 127 |
-
</div>
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
"status": "ok"
|
| 141 |
-
}</
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
<
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
<li><b>Format matrice</b> (requis pour l’évaluation) : <code>{"input": [[...], [...]]}</code></li>
|
| 169 |
-
<li><b>Format dictionnaires</b> (optionnel / compatibilité) : <code>{"input": [{"feature": value, ...}]}</code></li>
|
| 170 |
-
</ul>
|
| 171 |
-
</div>
|
| 172 |
-
|
| 173 |
-
<hr>
|
| 174 |
-
|
| 175 |
-
<h3>1) Format matrice (requis)</h3>
|
| 176 |
-
<p class="subtitle" style="margin-top:6px">
|
| 177 |
-
Chaque ligne doit contenir <b>exactement 13 valeurs</b>, dans l’ordre strict suivant (défini par <code>feature_order.json</code>) :
|
| 178 |
-
</p>
|
| 179 |
-
<pre><code>model_key, mileage, engine_power, fuel, paint_color, car_type,
|
| 180 |
private_parking_available, has_gps, has_air_conditioning, automatic_car,
|
| 181 |
-
has_getaround_connect, has_speed_regulator, winter_tires</
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
<p><b>Exemple de requête (matrice) :</b></p>
|
| 194 |
-
<pre><code>{
|
| 195 |
"input": [
|
| 196 |
["Citroën", 140411, 100, "diesel", "black", "convertible", 1, 1, 0, 0, 1, 1, 1]
|
| 197 |
]
|
| 198 |
-
}</
|
| 199 |
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
<h4>curl</h4>
|
| 203 |
-
<pre><code>curl -X POST "http://127.0.0.1:8000/predict" \
|
| 204 |
-H "Content-Type: application/json" \
|
| 205 |
-
-d '{"input":[["Citroën",140411,100,"diesel","black","convertible",1,1,0,0,1,1,1]]}'</
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
<pre><code>import requests
|
| 210 |
|
| 211 |
payload = {
|
| 212 |
"input": [
|
|
@@ -214,17 +105,15 @@ payload = {
|
|
| 214 |
]
|
| 215 |
}
|
| 216 |
|
| 217 |
-
r = requests.post("
|
| 218 |
-
print(r.json())
|
| 219 |
-
|
| 220 |
-
</div>
|
| 221 |
|
| 222 |
-
|
|
|
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
<p><b>Exemple de requête (dictionnaires) :</b></p>
|
| 227 |
-
<pre><code>{
|
| 228 |
"input": [
|
| 229 |
{
|
| 230 |
"model_key": "Citroën",
|
|
@@ -242,31 +131,28 @@ print(r.json())</code></pre>
|
|
| 242 |
"winter_tires": true
|
| 243 |
}
|
| 244 |
]
|
| 245 |
-
}</
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
|
| 262 |
-
<div class="card">
|
| 263 |
-
<h2>Notes</h2>
|
| 264 |
-
<ul>
|
| 265 |
-
<li>L’API supporte des prédictions en batch (plusieurs lignes dans <code>input</code>).</li>
|
| 266 |
-
<li>Les catégories inconnues peuvent être gérées par le pipeline du modèle (selon l’entraînement).</li>
|
| 267 |
-
<li>Pour éviter les erreurs 422, respecter strictement l’ordre et le nombre de features en mode matrice.</li>
|
| 268 |
-
</ul>
|
| 269 |
-
</div>
|
| 270 |
</body>
|
| 271 |
-
</html>
|
| 272 |
-
```
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
|
|
|
| 2 |
<html lang="fr">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Getaround — Documentation de l'API Pricing</title>
|
| 7 |
<style>
|
| 8 |
+
body { font-family: sans-serif; max-width: 860px; margin: 40px auto; padding: 0 24px; color: #1a1a1a; }
|
| 9 |
+
h1 { color: #1565C0; }
|
| 10 |
+
h2 { color: #1565C0; border-bottom: 1px solid #e0e0e0; padding-bottom: 6px; }
|
| 11 |
+
h3 { color: #333; }
|
| 12 |
+
code, pre { background: #f4f4f4; border-radius: 6px; padding: 2px 6px; font-family: monospace; font-size: 13px; }
|
| 13 |
+
pre { padding: 14px; overflow-x: auto; }
|
| 14 |
+
.endpoint { background: #f0f4ff; border-left: 4px solid #1565C0; padding: 10px 16px; border-radius: 6px; margin-bottom: 10px; }
|
| 15 |
+
.badge { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; margin-right: 8px; }
|
| 16 |
+
.get { background: #e3f2fd; color: #1565C0; }
|
| 17 |
+
.post { background: #fff3e0; color: #e65100; }
|
| 18 |
+
ul li { margin-bottom: 6px; }
|
| 19 |
+
.note { background: #fff8e1; border-left: 4px solid #f9a825; padding: 10px 16px; border-radius: 6px; margin-top: 16px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
</style>
|
| 21 |
</head>
|
|
|
|
| 22 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
<h1>🚗 Getaround — Documentation de l'API Pricing</h1>
|
| 25 |
+
<p>Documentation de l'API accessible via <code>/docs</code>. Cette API expose un modèle de Machine Learning qui prédit <code>rental_price_per_day</code> en fonction des caractéristiques du véhicule.</p>
|
| 26 |
+
|
| 27 |
+
<h2>Vue d'ensemble</h2>
|
| 28 |
+
<ul>
|
| 29 |
+
<li><span class="badge get">GET</span> <code>/</code> — Page d'accueil (HTML)</li>
|
| 30 |
+
<li><span class="badge get">GET</span> <code>/health</code> — Healthcheck (JSON)</li>
|
| 31 |
+
<li><span class="badge post">POST</span> <code>/predict</code> — Prédiction (JSON)</li>
|
| 32 |
+
<li><span class="badge get">GET</span> <code>/docs</code> — Documentation (HTML)</li>
|
| 33 |
+
</ul>
|
| 34 |
+
|
| 35 |
+
<h2>GET /</h2>
|
| 36 |
+
<div class="endpoint">
|
| 37 |
+
<span class="badge get">GET</span> Page d'accueil HTML listant les endpoints disponibles.
|
| 38 |
+
</div>
|
| 39 |
+
<pre>curl -s https://anabeldg-getaround-pricing-api.hf.space/</pre>
|
| 40 |
+
|
| 41 |
+
<h2>GET /health</h2>
|
| 42 |
+
<div class="endpoint">
|
| 43 |
+
<span class="badge get">GET</span> Vérifie que le service est actif et que le modèle est correctement chargé.
|
| 44 |
+
</div>
|
| 45 |
+
<pre>curl -s https://anabeldg-getaround-pricing-api.hf.space/health</pre>
|
| 46 |
+
<p>Réponse attendue :</p>
|
| 47 |
+
<pre>{
|
| 48 |
"status": "ok"
|
| 49 |
+
}</pre>
|
| 50 |
+
|
| 51 |
+
<h2>GET /docs</h2>
|
| 52 |
+
<div class="endpoint">
|
| 53 |
+
<span class="badge get">GET</span> Page HTML contenant la documentation de l'API.
|
| 54 |
+
</div>
|
| 55 |
+
<pre>curl -s https://anabeldg-getaround-pricing-api.hf.space/docs</pre>
|
| 56 |
+
|
| 57 |
+
<h2>POST /predict</h2>
|
| 58 |
+
<div class="endpoint">
|
| 59 |
+
<span class="badge post">POST</span> Retourne les prédictions de prix journalier (<code>rental_price_per_day</code>) pour une ou plusieurs lignes en entrée.
|
| 60 |
+
</div>
|
| 61 |
+
<ul>
|
| 62 |
+
<li><strong>Méthode :</strong> POST</li>
|
| 63 |
+
<li><strong>Entrée :</strong> JSON avec une clé <code>input</code></li>
|
| 64 |
+
<li><strong>Sortie :</strong> JSON <code>{"prediction": [...]}</code> (une prédiction par ligne)</li>
|
| 65 |
+
</ul>
|
| 66 |
+
|
| 67 |
+
<h3>Formats acceptés</h3>
|
| 68 |
+
<ul>
|
| 69 |
+
<li>Format matrice (requis pour l'évaluation) : <code>{"input": [[...], [...]]}</code></li>
|
| 70 |
+
<li>Format dictionnaires (optionnel / compatibilité) : <code>{"input": [{"feature": value, ...}]}</code></li>
|
| 71 |
+
</ul>
|
| 72 |
+
|
| 73 |
+
<h3>1) Format matrice (requis)</h3>
|
| 74 |
+
<p>Chaque ligne doit contenir exactement <strong>13 valeurs</strong>, dans l'ordre strict suivant (défini par <code>feature_order.json</code>) :</p>
|
| 75 |
+
<pre>model_key, mileage, engine_power, fuel, paint_color, car_type,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
private_parking_available, has_gps, has_air_conditioning, automatic_car,
|
| 77 |
+
has_getaround_connect, has_speed_regulator, winter_tires</pre>
|
| 78 |
+
|
| 79 |
+
<p>Types attendus :</p>
|
| 80 |
+
<ul>
|
| 81 |
+
<li><code>model_key</code>, <code>fuel</code>, <code>paint_color</code>, <code>car_type</code> → chaînes de caractères</li>
|
| 82 |
+
<li><code>mileage</code>, <code>engine_power</code> → valeurs numériques</li>
|
| 83 |
+
<li>Variables booléennes → <code>true</code>/<code>false</code> ou <code>0</code>/<code>1</code></li>
|
| 84 |
+
</ul>
|
| 85 |
+
<p>Si une ligne n'a pas 13 valeurs, l'API renvoie une erreur <code>422</code>.</p>
|
| 86 |
+
|
| 87 |
+
<p><strong>Exemple de requête (matrice) :</strong></p>
|
| 88 |
+
<pre>{
|
|
|
|
|
|
|
| 89 |
"input": [
|
| 90 |
["Citroën", 140411, 100, "diesel", "black", "convertible", 1, 1, 0, 0, 1, 1, 1]
|
| 91 |
]
|
| 92 |
+
}</pre>
|
| 93 |
|
| 94 |
+
<p><strong>curl :</strong></p>
|
| 95 |
+
<pre>curl -X POST "https://anabeldg-getaround-pricing-api.hf.space/predict" \
|
|
|
|
|
|
|
| 96 |
-H "Content-Type: application/json" \
|
| 97 |
+
-d '{"input":[["Citroën",140411,100,"diesel","black","convertible",1,1,0,0,1,1,1]]}'</pre>
|
| 98 |
+
|
| 99 |
+
<p><strong>Python :</strong></p>
|
| 100 |
+
<pre>import requests
|
|
|
|
| 101 |
|
| 102 |
payload = {
|
| 103 |
"input": [
|
|
|
|
| 105 |
]
|
| 106 |
}
|
| 107 |
|
| 108 |
+
r = requests.post("https://anabeldg-getaround-pricing-api.hf.space/predict", json=payload)
|
| 109 |
+
print(r.json())
|
| 110 |
+
# {"prediction": [106.57]}</pre>
|
|
|
|
| 111 |
|
| 112 |
+
<h3>2) Format dictionnaires (compatibilité)</h3>
|
| 113 |
+
<p>Ce format est accepté pour des raisons de compatibilité. Toutes les colonnes attendues doivent être présentes ; l'API réordonne ensuite selon <code>FEATURE_ORDER</code>.</p>
|
| 114 |
|
| 115 |
+
<p><strong>Exemple de requête (dictionnaires) :</strong></p>
|
| 116 |
+
<pre>{
|
|
|
|
|
|
|
| 117 |
"input": [
|
| 118 |
{
|
| 119 |
"model_key": "Citroën",
|
|
|
|
| 131 |
"winter_tires": true
|
| 132 |
}
|
| 133 |
]
|
| 134 |
+
}</pre>
|
| 135 |
+
|
| 136 |
+
<h3>Réponse</h3>
|
| 137 |
+
<p>Une prédiction par ligne.</p>
|
| 138 |
+
<pre>{
|
| 139 |
+
"prediction": [106.57]
|
| 140 |
+
}</pre>
|
| 141 |
+
|
| 142 |
+
<h2>Erreurs possibles</h2>
|
| 143 |
+
<ul>
|
| 144 |
+
<li><code>422</code> — entrée invalide (mauvaise dimension de matrice, colonnes manquantes, JSON invalide)</li>
|
| 145 |
+
<li><code>500</code> — erreur interne lors de la prédiction (échec du modèle)</li>
|
| 146 |
+
</ul>
|
| 147 |
+
|
| 148 |
+
<div class="note">
|
| 149 |
+
<strong>Notes :</strong>
|
| 150 |
+
<ul>
|
| 151 |
+
<li>L'API supporte des prédictions en batch (plusieurs lignes dans <code>input</code>).</li>
|
| 152 |
+
<li>Les catégories inconnues sont gérées par le pipeline du modèle.</li>
|
| 153 |
+
<li>Pour éviter les erreurs 422, respecter strictement l'ordre et le nombre de features en mode matrice.</li>
|
| 154 |
+
</ul>
|
| 155 |
+
</div>
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
</body>
|
| 158 |
+
</html>
|
|
|