In the default centos7 image we provide, the Python path is `/usr/bin/python`. If you want to use our centos6 image, you need to set it to `export PYTHONROOT=/usr/local/python2.7/`.
## Compile Server
## Compile Server
### Integrated CPU version paddle inference library
### Integrated CPU version paddle inference library
@@ -46,7 +46,7 @@ In this example, the production model is uploaded to HDFS in `product_path` fold
...
@@ -46,7 +46,7 @@ In this example, the production model is uploaded to HDFS in `product_path` fold
### Product model
### Product model
Run the following Python code products model in `product_path` folder. Every 60 seconds, the package file of Boston house price prediction model `uci_housing.tar.gz` will be generated and uploaded to the path of HDFS `/`. After uploading, the timestamp file `donefile` will be updated and uploaded to the path of HDFS `/`.
Run the following Python code products model in `product_path` folder(You need to modify Hadoop related parameters before running). Every 60 seconds, the package file of Boston house price prediction model `uci_housing.tar.gz` will be generated and uploaded to the path of HDFS `/`. After uploading, the timestamp file `donefile` will be updated and uploaded to the path of HDFS `/`.
```python
```python
importos
importos
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
exe.run(fluid.default_startup_program())
defpush_to_hdfs(local_file_path,remote_path):
defpush_to_hdfs(local_file_path,remote_path):
hadoop_bin='/hadoop-3.1.2/bin/hadoop'
afs='afs://***.***.***.***:***'# User needs to change
os.system('{} fs -put -f {} {}'.format(
uci='***,***'# User needs to change
hadoop_bin,local_file_path,remote_path))
hadoop_bin='/path/to/haddop/bin'# User needs to change
在`product_path`下运行下面的Python代码生产模型,每隔 60 秒会产出 Boston 房价预测模型的打包文件`uci_housing.tar.gz`并上传至hdfs的`/`路径下,上传完毕后更新时间戳文件`donefile`并上传至hdfs的`/`路径下。
在`product_path`下运行下面的Python代码生产模型(运行前需要修改hadoop相关的参数),每隔 60 秒会产出 Boston 房价预测模型的打包文件`uci_housing.tar.gz`并上传至hdfs的`/`路径下,上传完毕后更新时间戳文件`donefile`并上传至hdfs的`/`路径下。
```python
```python
importos
importos
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
...
@@ -82,9 +82,14 @@ exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
exe.run(fluid.default_startup_program())
defpush_to_hdfs(local_file_path,remote_path):
defpush_to_hdfs(local_file_path,remote_path):
hadoop_bin='/hadoop-3.1.2/bin/hadoop'
afs='afs://***.***.***.***:***'# User needs to change
os.system('{} fs -put -f {} {}'.format(
uci='***,***'# User needs to change
hadoop_bin,local_file_path,remote_path))
hadoop_bin='/path/to/haddop/bin'# User needs to change
In the Chinese sentiment classification task, the Chinese word segmentation needs to be done through [LAC task] (../lac). Set model path by ```lac_model_path``` and dictionary path by ```lac_dict_path```.
In the Chinese sentiment classification task, the Chinese word segmentation needs to be done through [LAC task] (../lac).
In this demo, the LAC task is placed in the preprocessing part of the HTTP prediction service of the sentiment classification task. The LAC prediction service is deployed on the CPU, and the sentiment classification task is deployed on the GPU, which can be changed according to the actual situation.
In this demo, the LAC task is placed in the preprocessing part of the HTTP prediction service of the sentiment classification task.
## Client prediction
## Client prediction
```
```
curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "天气不错"}], "fetch":["class_probs"]}' http://127.0.0.1:9292/senta/prediction
curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "天气不错"}], "fetch":["class_probs"]}' http://127.0.0.1:9292/senta/prediction
@@ -76,7 +76,7 @@ Preprocessing for Chinese word segmentation task.
...
@@ -76,7 +76,7 @@ Preprocessing for Chinese word segmentation task.
[example](../examples/senta/senta_web_service.py)
[example](../examples/senta/senta_web_service.py)
- The image preprocessing method is more flexible than the above method, and can be combined by the following multiple classes,[example](../examples/imagenet/image_rpc_client.py)
- The image preprocessing method is more flexible than the above method, and can be combined by the following multiple classes,[example](../examples/imagenet/resnet50_rpc_client.py)