Commit 9045bdce by lichenggang

serve log

parent e77fb05c
...@@ -6,14 +6,17 @@ from protobuf import classify_pb2_grpc ...@@ -6,14 +6,17 @@ from protobuf import classify_pb2_grpc
from utils.config import model_config from utils.config import model_config
from utils.predic_fac import PredictorFac from utils.predic_fac import PredictorFac
from utils.log_manager import get_logger
log_server = get_logger('server')
class Classify(classify_pb2_grpc.classifyServicer): class Classify(classify_pb2_grpc.classifyServicer):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
log_server.info('classify server start!')
self.predictorfac = PredictorFac(model_config) self.predictorfac = PredictorFac(model_config)
def SingleClassify(self, request, context): def SingleClassify(self, request, context):
log_server.debug('接收数据: ' + request.keyword)
res = self.predictorfac.predic(request.keyword) res = self.predictorfac.predic(request.keyword)
return classify_pb2.SingleClassifyReply(message='result {msg}'.format(msg=res)) return classify_pb2.SingleClassifyReply(message='result {msg}'.format(msg=res))
...@@ -37,4 +40,4 @@ def serve(): ...@@ -37,4 +40,4 @@ def serve():
if __name__ == '__main__': if __name__ == '__main__':
serve() serve()
print(Classify().fac_test_predic('lm358')) # print(Classify().fac_test_predic('lm358'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment