From c500fcb3eaebef66de74522ecc7722be180f8d72 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Mon, 25 May 2020 06:33:44 +0000 Subject: [PATCH] fix demo --- python/examples/bert/benchmark.py | 4 ++-- python/examples/bert/bert_web_service.py | 8 ++++---- python/examples/imagenet/resnet50_web_service.py | 4 ++-- python/examples/imdb/text_classify_service.py | 4 ++-- python/examples/lac/benchmark.py | 2 +- python/examples/lac/lac_client.py | 2 +- python/examples/lac/lac_web_service.py | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/python/examples/bert/benchmark.py b/python/examples/bert/benchmark.py index e14c02fe..af75b718 100644 --- a/python/examples/bert/benchmark.py +++ b/python/examples/bert/benchmark.py @@ -26,7 +26,7 @@ from batching import pad_batch_data import tokenization import requests import json -from bert_reader import BertReader +from paddle_serving_app.reader import ChineseBertReader args = benchmark_args() @@ -37,7 +37,7 @@ def single_func(idx, resource): for line in fin: dataset.append(line.strip()) if args.request == "rpc": - reader = BertReader(vocab_file="vocab.txt", max_seq_len=20) + reader = ChineseBertReader(vocab_file="vocab.txt", max_seq_len=20) fetch = ["pooled_output"] client = Client() client.load_client_config(args.model) diff --git a/python/examples/bert/bert_web_service.py b/python/examples/bert/bert_web_service.py index 6a5830ea..d7215087 100644 --- a/python/examples/bert/bert_web_service.py +++ b/python/examples/bert/bert_web_service.py @@ -14,14 +14,14 @@ # limitations under the License. # pylint: disable=doc-string-missing from paddle_serving_server_gpu.web_service import WebService -from bert_reader import BertReader +from paddle_serving_app.reader import ChineseBertReader import sys import os class BertService(WebService): def load(self): - self.reader = BertReader(vocab_file="vocab.txt", max_seq_len=128) + self.reader = ChineseBertReader(vocab_file="vocab.txt", max_seq_len=128) def preprocess(self, feed=[], fetch=[]): feed_res = [ @@ -37,5 +37,5 @@ gpu_ids = os.environ["CUDA_VISIBLE_DEVICES"] bert_service.set_gpus(gpu_ids) bert_service.prepare_server( workdir="workdir", port=int(sys.argv[2]), device="gpu") -bert_service.run_server() -bert_service.run_flask() +bert_service.run_rpc_service() +bert_service.run_web_service() diff --git a/python/examples/imagenet/resnet50_web_service.py b/python/examples/imagenet/resnet50_web_service.py index ba40b41b..3966d31c 100644 --- a/python/examples/imagenet/resnet50_web_service.py +++ b/python/examples/imagenet/resnet50_web_service.py @@ -68,5 +68,5 @@ if device == "gpu": image_service.set_gpus("0,1") image_service.prepare_server( workdir="workdir", port=int(sys.argv[3]), device=device) -image_service.run_server() -image_service.run_flask() +image_service.run_rpc_service() +image_service.run_web_service() diff --git a/python/examples/imdb/text_classify_service.py b/python/examples/imdb/text_classify_service.py index 2401d9a2..fe6ab031 100755 --- a/python/examples/imdb/text_classify_service.py +++ b/python/examples/imdb/text_classify_service.py @@ -37,5 +37,5 @@ imdb_service.load_model_config(sys.argv[1]) imdb_service.prepare_server( workdir=sys.argv[2], port=int(sys.argv[3]), device="cpu") imdb_service.prepare_dict({"dict_file_path": sys.argv[4]}) -imdb_service.run_server() -imdb_service.run_flask() +imdb_service.run_rpc_service() +imdb_service.run_web_service() diff --git a/python/examples/lac/benchmark.py b/python/examples/lac/benchmark.py index 53d0881e..80e7fa40 100644 --- a/python/examples/lac/benchmark.py +++ b/python/examples/lac/benchmark.py @@ -16,7 +16,7 @@ import sys import time import requests -from lac_reader import LACReader +from paddle_serving_app.reader import LACReader from paddle_serving_client import Client from paddle_serving_client.utils import MultiThreadRunner from paddle_serving_client.utils import benchmark_args diff --git a/python/examples/lac/lac_client.py b/python/examples/lac/lac_client.py index 9c485a92..9342cc50 100644 --- a/python/examples/lac/lac_client.py +++ b/python/examples/lac/lac_client.py @@ -15,7 +15,7 @@ # pylint: disable=doc-string-missing from paddle_serving_client import Client -from lac_reader import LACReader +from paddle_serving_app.reader import LACReader import sys import os import io diff --git a/python/examples/lac/lac_web_service.py b/python/examples/lac/lac_web_service.py index c9bd0098..62a7148b 100644 --- a/python/examples/lac/lac_web_service.py +++ b/python/examples/lac/lac_web_service.py @@ -47,5 +47,5 @@ lac_service.load_model_config(sys.argv[1]) lac_service.load_reader() lac_service.prepare_server( workdir=sys.argv[2], port=int(sys.argv[3]), device="cpu") -lac_service.run_server() -lac_service.run_flask() +lac_service.run_rpc_service() +lac_service.run_web_service() -- GitLab