Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Pricing Optimization API
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
##
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
- `GET /docs` β interactive API docs
|
| 10 |
|
| 11 |
-
##
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
|
|
|
| 14 |
```json
|
| 15 |
{
|
| 16 |
"input": [[
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Pricing Optimization API
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
license: mit
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
# Pricing Optimization API
|
| 13 |
|
| 14 |
+
This is a production-ready **FastAPI** service that serves your **scikit-learn Pipeline**.
|
| 15 |
+
It exposes:
|
| 16 |
+
- `POST /predict` β batch predictions
|
| 17 |
+
- `GET /docs` β interactive Swagger UI
|
| 18 |
+
- `GET /` β simple health check
|
| 19 |
|
| 20 |
+
## Why this setup?
|
| 21 |
+
- The saved artifact `RF_model.joblib` contains both preprocessing and the model, so serving is consistent with training.
|
| 22 |
+
- The API accepts mixed types (strings/ints/bools/floats) and converts them into a **pandas DataFrame** with the **exact** column names used at training, allowing `ColumnTransformer` to work reliably.
|
|
|
|
| 23 |
|
| 24 |
+
## Expected input format
|
| 25 |
+
- Body: `{"input": [[f1, f2, ..., fN], ...]}` β 2D list (batch of rows).
|
| 26 |
+
- **Order matters**: the order must match `feature_names` saved in your bundle.
|
| 27 |
+
- Booleans must be JSON booleans (`true`/`false`) β not strings.
|
| 28 |
|
| 29 |
+
**Example**
|
| 30 |
```json
|
| 31 |
{
|
| 32 |
"input": [[
|