sony9316's picture
Update README.md
43eae10 verified
|
Raw
History Blame Contribute Delete
1.17 kB
---
title: Pricing Optimization API
emoji: πŸš—
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
license: mit
---
# Pricing Optimization API
This is a production-ready **FastAPI** service that serves your **scikit-learn Pipeline**.
It exposes:
- `POST /predict` β€” batch predictions
- `GET /docs` β€” interactive Swagger UI
- `GET /` β€” simple health check
## Why this setup?
- The saved artifact `RF_model.joblib` contains both preprocessing and the model, so serving is consistent with training.
- 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.
## Expected input format
- Body: `{"input": [[f1, f2, ..., fN], ...]}` β€” 2D list (batch of rows).
- **Order matters**: the order must match `feature_names` saved in your bundle.
- Booleans must be JSON booleans (`true`/`false`) β€” not strings.
**Example**
```json
{
"input": [[
"Peugeot",
174631,
120,
"diesel",
"black",
"convertible",
true,
true,
false,
false,
false,
false,
true
]]
}