From 9d319abb2e3c14d0c38436fcf10964e3d078c66a Mon Sep 17 00:00:00 2001 From: zhangjun Date: Sun, 25 Apr 2021 03:52:00 +0000 Subject: [PATCH] update --- python/examples/xpu/fit_a_line_xpu/README.md | 21 +++++++++++++------ .../examples/xpu/fit_a_line_xpu/README_CN.md | 15 +++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/python/examples/xpu/fit_a_line_xpu/README.md b/python/examples/xpu/fit_a_line_xpu/README.md index b8108dec..e54dc69f 100644 --- a/python/examples/xpu/fit_a_line_xpu/README.md +++ b/python/examples/xpu/fit_a_line_xpu/README.md @@ -8,15 +8,10 @@ sh get_data.sh ``` - - ## RPC service ### Start server -``` shell -python test_server.py uci_housing_model/ -``` -You can alse use the following code to start the RPC service +You can use the following code to start the RPC service ```shell python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393 --use_lite --use_xpu --ir_optim ``` @@ -29,3 +24,17 @@ The `paddlepaddle` package is used in `test_client.py`, and you may need to down python test_client.py uci_housing_client/serving_client_conf.prototxt ``` +## HTTP service + +### Start server + +Start a web service with default web service hosting modules: +``` shell +python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393 --use_lite --use_xpu --ir_optim --name uci +``` + +### Client prediction + +``` shell +curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"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 +``` diff --git a/python/examples/xpu/fit_a_line_xpu/README_CN.md b/python/examples/xpu/fit_a_line_xpu/README_CN.md index 19549aca..e19a17af 100644 --- a/python/examples/xpu/fit_a_line_xpu/README_CN.md +++ b/python/examples/xpu/fit_a_line_xpu/README_CN.md @@ -32,3 +32,18 @@ python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --po python test_client.py uci_housing_client/serving_client_conf.prototxt ``` +## HTTP服务 + +### 开启服务端 + +通过下面的一行代码开启默认web服务: + +``` shell +python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9393 --use_lite --use_xpu --ir_optim --name uci +``` + +### 客户端预测 + +``` shell +curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"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 +``` -- GitLab