sony9316 commited on
Commit
43eae10
Β·
verified Β·
1 Parent(s): bc9d771

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -8
README.md CHANGED
@@ -1,16 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # Pricing Optimization API
2
 
3
- Production-ready FastAPI for `/predict` with built-in `/docs` (Swagger UI).
4
- Just drop your trained bundle `RF_model.joblib` (containing `{"model": pipeline, "feature_names": [...]}`) into this folder and deploy.
 
 
 
5
 
6
- ## Endpoints
7
- - `GET /` β€” health check
8
- - `POST /predict` β€” body: `{"input": [[f1, f2, ..., fN], ...]}` β†’ returns `{"prediction": [..]}`
9
- - `GET /docs` β€” interactive API docs
10
 
11
- ## Input format
12
- The model expects **N features** in a specific order (printed to logs on startup). For mixed types (categorical + numeric + booleans), send them exactly as trained. Example:
 
 
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": [[