提交 4128c869 编写于 作者: D Dong Daxiang 提交者: GitHub

Merge pull request #639 from MRXLT/0.3.0-bug-fix

0.3.0 bug fix
...@@ -35,5 +35,4 @@ for line in sys.stdin: ...@@ -35,5 +35,4 @@ for line in sys.stdin:
begin = fetch_map['crf_decode.lod'][0] begin = fetch_map['crf_decode.lod'][0]
end = fetch_map['crf_decode.lod'][1] end = fetch_map['crf_decode.lod'][1]
segs = reader.parse_result(line, fetch_map["crf_decode"][begin:end]) segs = reader.parse_result(line, fetch_map["crf_decode"][begin:end])
print("word_seg: " + "|".join(str(words) for words in segs))
print({"word_seg": "|".join(segs)})
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
``` ```
python -m paddle_serving_app.package --get_model senta_bilstm python -m paddle_serving_app.package --get_model senta_bilstm
python -m paddle_serving_app.package --get_model lac python -m paddle_serving_app.package --get_model lac
tar -xzvf senta_bilstm.tar.gz
tar -xzvf lac.tar.gz
``` ```
## Start HTTP Service ## Start HTTP Service
...@@ -17,5 +19,5 @@ In this demo, the LAC task is placed in the preprocessing part of the HTTP predi ...@@ -17,5 +19,5 @@ In this demo, the LAC task is placed in the preprocessing part of the HTTP predi
## 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:9393/senta/prediction
``` ```
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
``` ```
python -m paddle_serving_app.package --get_model senta_bilstm python -m paddle_serving_app.package --get_model senta_bilstm
python -m paddle_serving_app.package --get_model lac python -m paddle_serving_app.package --get_model lac
tar -xzvf lac.tar.gz
tar -xzvf senta_bilstm.tar.gz
``` ```
## 启动HTTP服务 ## 启动HTTP服务
...@@ -17,5 +19,5 @@ python senta_web_service.py ...@@ -17,5 +19,5 @@ python senta_web_service.py
## 客户端预测 ## 客户端预测
``` ```
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:9393/senta/prediction
``` ```
...@@ -38,7 +38,7 @@ class ServingModels(object): ...@@ -38,7 +38,7 @@ class ServingModels(object):
object_detection_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/ObjectDetection/" object_detection_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/ObjectDetection/"
ocr_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/OCR/" ocr_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/OCR/"
senta_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SentimentAnalysis/" senta_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SentimentAnalysis/"
semantic_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SemanticRepresentation/" semantic_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SemanticModel/"
wordseg_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/LexicalAnalysis/" wordseg_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/LexicalAnalysis/"
self.url_dict = {} self.url_dict = {}
......
...@@ -111,6 +111,10 @@ class LACReader(object): ...@@ -111,6 +111,10 @@ class LACReader(object):
return word_ids return word_ids
def parse_result(self, words, crf_decode): def parse_result(self, words, crf_decode):
try:
words = unicode(words, "utf-8")
except:
pass
tags = [self.id2label_dict[str(x[0])] for x in crf_decode] tags = [self.id2label_dict[str(x[0])] for x in crf_decode]
sent_out = [] sent_out = []
......
...@@ -20,7 +20,7 @@ Usage: ...@@ -20,7 +20,7 @@ Usage:
import os import os
import time import time
import argparse import argparse
import commands import subprocess
import datetime import datetime
import shutil import shutil
import tarfile import tarfile
...@@ -209,7 +209,7 @@ class HadoopMonitor(Monitor): ...@@ -209,7 +209,7 @@ class HadoopMonitor(Monitor):
remote_filepath = os.path.join(path, filename) remote_filepath = os.path.join(path, filename)
cmd = '{} -ls {} 2>/dev/null'.format(self._cmd_prefix, remote_filepath) cmd = '{} -ls {} 2>/dev/null'.format(self._cmd_prefix, remote_filepath)
_LOGGER.debug('check cmd: {}'.format(cmd)) _LOGGER.debug('check cmd: {}'.format(cmd))
[status, output] = commands.getstatusoutput(cmd) [status, output] = subprocess.getstatusoutput(cmd)
_LOGGER.debug('resp: {}'.format(output)) _LOGGER.debug('resp: {}'.format(output))
if status == 0: if status == 0:
[_, _, _, _, _, mdate, mtime, _] = output.split('\n')[-1].split() [_, _, _, _, _, mdate, mtime, _] = output.split('\n')[-1].split()
......
...@@ -20,7 +20,7 @@ Usage: ...@@ -20,7 +20,7 @@ Usage:
import os import os
import time import time
import argparse import argparse
import commands import subprocess
import datetime import datetime
import shutil import shutil
import tarfile import tarfile
...@@ -209,7 +209,7 @@ class HadoopMonitor(Monitor): ...@@ -209,7 +209,7 @@ class HadoopMonitor(Monitor):
remote_filepath = os.path.join(path, filename) remote_filepath = os.path.join(path, filename)
cmd = '{} -ls {} 2>/dev/null'.format(self._cmd_prefix, remote_filepath) cmd = '{} -ls {} 2>/dev/null'.format(self._cmd_prefix, remote_filepath)
_LOGGER.debug('check cmd: {}'.format(cmd)) _LOGGER.debug('check cmd: {}'.format(cmd))
[status, output] = commands.getstatusoutput(cmd) [status, output] = subprocess.getstatusoutput(cmd)
_LOGGER.debug('resp: {}'.format(output)) _LOGGER.debug('resp: {}'.format(output))
if status == 0: if status == 0:
[_, _, _, _, _, mdate, mtime, _] = output.split('\n')[-1].split() [_, _, _, _, _, mdate, mtime, _] = output.split('\n')[-1].split()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册