提交 4969600f 编写于 作者: G guru4elephant

fix web serve bug

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