diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 31ba66cff68ce1e9f00b5d533cef67d3f2b08f71..ffa8e6eb5b2f3d38d2d2a6525a39356dd014e5d1 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -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(): diff --git a/python/paddle_serving_server_gpu/web_serve.py b/python/paddle_serving_server_gpu/web_serve.py index c270997e228a07bc24a9214b93e8fe3494bcc1c7..de7130afb90b38cc867edab8134c297ad326989d 100644 --- a/python/paddle_serving_server_gpu/web_serve.py +++ b/python/paddle_serving_server_gpu/web_serve.py @@ -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() diff --git a/python/paddle_serving_server_gpu/web_service.py b/python/paddle_serving_server_gpu/web_service.py index c90a6319c409d75cebe3f1bf87b14a3277f569a7..6d2039040178c118f48a09563735d97cca3c10c7 100755 --- a/python/paddle_serving_server_gpu/web_service.py +++ b/python/paddle_serving_server_gpu/web_service.py @@ -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)