未验证 提交 9c71c83e 编写于 作者: M MRXLT 提交者: GitHub

Merge pull request #267 from guru4elephant/fix_web_service_bug

Fix web service bug
......@@ -71,7 +71,7 @@ class WebService(object):
feed=request.json, fetch=fetch, fetch_map=fetch_map)
return fetch_map
app_instance.run(host="127.0.0.1",
app_instance.run(host="0.0.0.0",
port=self.port,
threaded=False,
processes=1)
......
......@@ -22,6 +22,7 @@ import socket
import paddle_serving_server_gpu as paddle_serving_server
from version import serving_server_version
from contextlib import closing
import argparse
def serve_args():
......
......@@ -27,10 +27,13 @@ if __name__ == "__main__":
args = serve_args()
web_service = WebService(name=args.name)
web_service.load_model_config(args.model)
gpu_ids = []
if args.gpu_ids == "":
gpu_ids = os.environ["CUDA_VISIBLE_DEVICES"]
gpus = [int(x) for x in gpu_ids.split(",")]
web_service.set_gpus(gpus)
if "CUDA_VISIBLE_DEVICES" in os.environ:
gpu_ids = os.environ["CUDA_VISIBLE_DEVICES"]
if len(gpu_ids) > 0:
gpus = [int(x) for x in gpu_ids.split(",")]
web_service.set_gpus(gpus)
web_service.prepare_server(
workdir=args.workdir, port=args.port, device=args.device)
service.run_server()
......@@ -112,7 +112,7 @@ class WebService(object):
feed=request.json, fetch=fetch, fetch_map=fetch_map)
return fetch_map
app_instance.run(host="127.0.0.1",
app_instance.run(host="0.0.0.0",
port=self.port,
threaded=False,
processes=1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册