From 0d3542b22f52fee9c737338e6d06052ea70866ec Mon Sep 17 00:00:00 2001 From: ShenYuhan Date: Tue, 18 Aug 2020 11:44:29 +0800 Subject: [PATCH] modify lac serving demo. (#824) * modify lac serving demo. * update lac_serving_demo.py --- demo/serving/module_serving/lexical_analysis_lac/README.md | 2 +- .../module_serving/lexical_analysis_lac/lac_serving_demo.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/demo/serving/module_serving/lexical_analysis_lac/README.md b/demo/serving/module_serving/lexical_analysis_lac/README.md index b91346da..6fbe296c 100644 --- a/demo/serving/module_serving/lexical_analysis_lac/README.md +++ b/demo/serving/module_serving/lexical_analysis_lac/README.md @@ -146,4 +146,4 @@ if __name__ == "__main__": ] } ``` -此Demo的具体信息和代码请参见[LAC Serving_2.1.0](lac_2.1.0_serving_demo.py)。 +此Demo的具体信息和代码请参见[LAC Serving](./lac_serving_demo.py)。 diff --git a/demo/serving/module_serving/lexical_analysis_lac/lac_serving_demo.py b/demo/serving/module_serving/lexical_analysis_lac/lac_serving_demo.py index 05e40f8a..96a585bf 100644 --- a/demo/serving/module_serving/lexical_analysis_lac/lac_serving_demo.py +++ b/demo/serving/module_serving/lexical_analysis_lac/lac_serving_demo.py @@ -7,7 +7,8 @@ if __name__ == "__main__": text = ["今天是个好日子", "天气预报说今天要下雨"] # 以key的方式指定text传入预测方法的时的参数,此例中为"data" # 对应本地部署,则为lac.analysis_lexical(data=text, batch_size=1) - data = {"texts": text, "batch_size": 1} + # 若使用lac版本低于2.2.0,需要将`text`参数改为`texts` + data = {"text": text, "batch_size": 1} # 指定预测方法为lac并发送post请求,content-type类型应指定json方式 url = "http://127.0.0.1:8866/predict/lac" # 指定post请求的headers为application/json方式 -- GitLab