提交 42850f60 编写于 作者: B barrierye

issue fix #426

上级 fa842ae6
# Fit a line example, prediction through rpc service # Fit a line prediction example
([简体中文](./README_CN.md)|English) ([简体中文](./README_CN.md)|English)
## Start rpc service ## Get data
``` shell
```shell
sh get_data.sh sh get_data.sh
```
## RPC service
### Start server
``` shell
python test_server.py uci_housing_model/ python test_server.py uci_housing_model/
``` ```
## Prediction 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`).
``` shell ``` shell
python test_client.py uci_housing_client/serving_client_conf.prototxt python test_client.py uci_housing_client/serving_client_conf.prototxt
``` ```
## prediction through http service
Start a web service with default web service hosting modules
## HTTP service
### Start server
Start a web service with default web service hosting modules:
``` shell ``` shell
python -m paddle_serving_server.web_serve --model uci_housing_model/ --thread 10 --name uci --port 9393 --name uci python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393 --name uci
``` ```
## Prediction through http post ### Client prediction
``` shell ``` 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 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
``` ```
# 线性回归,RPC预测服务示例 # 线性回归预测服务示例
(简体中文|[English](./README.md)) (简体中文|[English](./README.md))
## 开启RPC服务端 ## 获取数据
``` shell
```shell
sh get_data.sh sh get_data.sh
```
## RPC服务
### 开启服务端
``` shell
python test_server.py uci_housing_model/ python test_server.py uci_housing_model/
``` ```
## RPC预测 也可以通过下面的一行代码开启默认RPC服务:
```shell
python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393
```
### 客户端预测
`test_client.py`中使用了`paddlepaddle`包,需要进行下载(`pip install paddlepaddle`)。
``` shell ``` shell
python test_client.py uci_housing_client/serving_client_conf.prototxt python test_client.py uci_housing_client/serving_client_conf.prototxt
``` ```
## 开启HTTP服务端
Start a web service with default web service hosting modules
## HTTP服务
### 开启服务端
通过下面的一行代码开启默认web服务:
``` shell ``` shell
python -m paddle_serving_server.web_serve --model uci_housing_model/ --thread 10 --name uci --port 9393 --name uci python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393 --name uci
``` ```
## HTTP预测 ### 客户端预测
``` shell ``` 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 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
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册