README.md 994 字节
Newer Older
M
MRXLT 已提交
1
# Chinese sentence sentiment classification
M
MRXLT 已提交
2
([简体中文](./README_CN.md)|English)
M
MRXLT 已提交
3 4 5 6
## Get model files and sample data
```
sh get_data.sh
```
M
MRXLT 已提交
7 8 9 10 11 12
## Install preprocess module

```
pip install paddle_serving_app
```

M
MRXLT 已提交
13 14 15 16
## Start http service
```
python senta_web_service.py senta_bilstm_model/ workdir 9292
```
M
MRXLT 已提交
17
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```. 
M
MRXLT 已提交
18
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.
M
MRXLT 已提交
19 20
## Client prediction
```
M
MRXLT 已提交
21
curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "天气不错"}], "fetch":["class_probs"]}' http://127.0.0.1:9292/senta/prediction
M
MRXLT 已提交
22
```