Spaces:
Sleeping
Sleeping
madamanastasia commited on
Commit ·
2f5bda1
1
Parent(s): 430001f
Fix custom docs path
Browse files
docs.html
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 6 |
+
<title>Getaround — Pricing Optimization API</title>
|
| 7 |
+
<style>
|
| 8 |
+
body { font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif; line-height: 1.5; margin: 0; }
|
| 9 |
+
header { padding: 32px 20px; border-bottom: 1px solid #eee; }
|
| 10 |
+
main { max-width: 980px; margin: 0 auto; padding: 20px; }
|
| 11 |
+
h1 { margin: 0 0 8px 0; font-size: 28px; }
|
| 12 |
+
h2 { margin-top: 24px; font-size: 20px; }
|
| 13 |
+
p { margin: 8px 0; }
|
| 14 |
+
code, pre { font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; }
|
| 15 |
+
pre { background: #f7f7f8; padding: 14px; border-radius: 10px; overflow-x: auto; }
|
| 16 |
+
.endpoint { padding: 14px; border: 1px solid #eee; border-radius: 12px; margin: 14px 0; }
|
| 17 |
+
.method { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
|
| 18 |
+
.get { background: #e8f5e9; }
|
| 19 |
+
.post { background: #e3f2fd; }
|
| 20 |
+
.path { font-weight: 800; margin-left: 8px; }
|
| 21 |
+
.note { background: #fff8e1; border: 1px solid #ffe0b2; padding: 10px 12px; border-radius: 10px; margin-top: 10px; }
|
| 22 |
+
</style>
|
| 23 |
+
</head>
|
| 24 |
+
<body>
|
| 25 |
+
<header>
|
| 26 |
+
<h1>Getaround — Pricing Optimization API</h1>
|
| 27 |
+
<p>This API exposes a pricing model that predicts <code>rental_price_per_day</code> for a car based on its characteristics.</p>
|
| 28 |
+
</header>
|
| 29 |
+
|
| 30 |
+
<main>
|
| 31 |
+
<div class="endpoint">
|
| 32 |
+
<div><span class="method get">GET</span><span class="path">/health</span></div>
|
| 33 |
+
<p>Healthcheck endpoint.</p>
|
| 34 |
+
<pre><code>curl -s http://127.0.0.1:8000/health
|
| 35 |
+
{"status":"ok"}</code></pre>
|
| 36 |
+
</div>
|
| 37 |
+
|
| 38 |
+
<div class="endpoint">
|
| 39 |
+
<div><span class="method post">POST</span><span class="path">/predict</span></div>
|
| 40 |
+
<p>Returns the predicted daily rental price for one or many cars.</p>
|
| 41 |
+
|
| 42 |
+
<p><strong>Accepted input format</strong> (JSON body):</p>
|
| 43 |
+
<ul>
|
| 44 |
+
<li><strong>List of dicts (recommended)</strong>: each dict contains the car fields.</li>
|
| 45 |
+
</ul>
|
| 46 |
+
|
| 47 |
+
<div class="note">
|
| 48 |
+
<strong>Note:</strong> If you want to support <code>list-of-lists</code> inputs, you must keep a strict feature order and validate the length.
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
<p><strong>Example (dict format):</strong></p>
|
| 52 |
+
<pre><code>{
|
| 53 |
+
"input": [
|
| 54 |
+
{
|
| 55 |
+
"model_key": "Citroën",
|
| 56 |
+
"mileage": 140411,
|
| 57 |
+
"engine_power": 100,
|
| 58 |
+
"fuel": "diesel",
|
| 59 |
+
"paint_color": "black",
|
| 60 |
+
"car_type": "convertible",
|
| 61 |
+
"private_parking_available": true,
|
| 62 |
+
"has_gps": true,
|
| 63 |
+
"has_air_conditioning": false,
|
| 64 |
+
"automatic_car": false,
|
| 65 |
+
"has_getaround_connect": true,
|
| 66 |
+
"has_speed_regulator": true,
|
| 67 |
+
"winter_tires": true
|
| 68 |
+
}
|
| 69 |
+
]
|
| 70 |
+
}</code></pre>
|
| 71 |
+
|
| 72 |
+
<p><strong>Example response:</strong></p>
|
| 73 |
+
<pre><code>{"prediction":[106.2]}</code></pre>
|
| 74 |
+
|
| 75 |
+
<p><strong>Example (curl):</strong></p>
|
| 76 |
+
<pre><code>curl -i -H "Content-Type: application/json" -X POST \
|
| 77 |
+
-d '{"input":[{"model_key":"Citroën","mileage":140411,"engine_power":100,"fuel":"diesel","paint_color":"black","car_type":"convertible","private_parking_available":true,"has_gps":true,"has_air_conditioning":false,"automatic_car":false,"has_getaround_connect":true,"has_speed_regulator":true,"winter_tires":true}]}' \
|
| 78 |
+
http://127.0.0.1:8000/predict</code></pre>
|
| 79 |
+
|
| 80 |
+
<p><strong>Example (python):</strong></p>
|
| 81 |
+
<pre><code>import requests
|
| 82 |
+
|
| 83 |
+
payload = {
|
| 84 |
+
"input": [{
|
| 85 |
+
"model_key": "Citroën",
|
| 86 |
+
"mileage": 140411,
|
| 87 |
+
"engine_power": 100,
|
| 88 |
+
"fuel": "diesel",
|
| 89 |
+
"paint_color": "black",
|
| 90 |
+
"car_type": "convertible",
|
| 91 |
+
"private_parking_available": True,
|
| 92 |
+
"has_gps": True,
|
| 93 |
+
"has_air_conditioning": False,
|
| 94 |
+
"automatic_car": False,
|
| 95 |
+
"has_getaround_connect": True,
|
| 96 |
+
"has_speed_regulator": True,
|
| 97 |
+
"winter_tires": True
|
| 98 |
+
}]
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
r = requests.post("http://127.0.0.1:8000/predict", json=payload)
|
| 102 |
+
print(r.json())</code></pre>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<div class="endpoint">
|
| 106 |
+
<div><span class="method get">GET</span><span class="path">/docs</span></div>
|
| 107 |
+
<p>Returns this documentation page.</p>
|
| 108 |
+
</div>
|
| 109 |
+
</main>
|
| 110 |
+
</body>
|
| 111 |
+
</html>
|