提交 ece6b883 编写于 作者: G guru4elephant

try to add multiple gpu card for web service

上级 5c6dfe88
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
g # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -24,6 +24,10 @@ import time
import random
def producers(input_queue, output_queue, endpoint):
pass
class WebService(object):
def __init__(self, name="default_service"):
self.name = name
......@@ -100,6 +104,18 @@ class WebService(object):
time.sleep(1)
service_name = "/" + self.name + "/prediction"
input_queues = []
output_queue = Queue()
for i in range(gpu_num):
input_queues.append(Queue())
@app_instance.route("{}_batch".format(service_name), methods['POST'])
def get_prediction():
if not request.json:
abort(400)
if "fetch" not in request.json:
abort(400)
@app_instance.route(service_name, methods=['POST'])
def get_prediction():
if not request.json:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册