From 59ecbdadc1f7e0a220cd173ae926a0bb75b49214 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Thu, 21 May 2020 15:39:21 +0800 Subject: [PATCH] fix bert http demo --- python/examples/bert/bert_web_service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/examples/bert/bert_web_service.py b/python/examples/bert/bert_web_service.py index 8db64e5e..6a5830ea 100644 --- a/python/examples/bert/bert_web_service.py +++ b/python/examples/bert/bert_web_service.py @@ -23,10 +23,10 @@ class BertService(WebService): def load(self): self.reader = BertReader(vocab_file="vocab.txt", max_seq_len=128) - def preprocess(self, feed={}, fetch=[]): - feed_res = [{ - "words": self.reader.process(ins["words"].encode("utf-8")) - } for ins in feed] + def preprocess(self, feed=[], fetch=[]): + feed_res = [ + self.reader.process(ins["words"].encode("utf-8")) for ins in feed + ] return feed_res, fetch -- GitLab