README.md 1.1 KB
Newer Older
B
barrierye 已提交
1
# Fit a line prediction example
J
Jiawei Wang 已提交
2 3 4

([简体中文](./README_CN.md)|English)

B
barrierye 已提交
5 6 7
## Get data

```shell
8
sh get_data.sh
B
barrierye 已提交
9 10 11 12 13 14 15 16 17
```



## RPC service

### Start server

``` shell
18 19 20
python test_server.py uci_housing_model/
```

B
barrierye 已提交
21 22 23 24 25 26 27 28 29 30
You can also start the default RPC service with the following line of code:

```shell
python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393
```

### Client prediction

The `paddlepaddle` package is used in `test_client.py`, and you may need to download the corresponding package(`pip install paddlepaddle`).

31 32 33 34
``` shell
python test_client.py uci_housing_client/serving_client_conf.prototxt
```

B
barrierye 已提交
35 36 37 38 39 40 41


## HTTP service

### Start server

Start a web service with default web service hosting modules:
42
``` shell
B
barrierye 已提交
43
python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393 --name uci
44 45
```

B
barrierye 已提交
46 47
### Client prediction

48 49
``` shell
curl -H "Content-Type:application/json" -X POST -d '{"x": [0.0137, -0.1136, 0.2553, -0.0692, 0.0582, -0.0727, -0.1583, -0.0584, 0.6283, 0.4919, 0.1856, 0.0795, -0.0332], "fetch":["price"]}' http://127.0.0.1:9393/uci/prediction
B
barrierye 已提交
50
```