Exemplo n.º 1
0
    else:
        user_object = user_class(**parameters)

    if args.service_type == "MODEL":
        import model_microservice as seldon_microservice
    elif args.service_type == "ROUTER":
        import router_microservice as seldon_microservice
    elif args.service_type == "TRANSFORMER":
        import transformer_microservice as seldon_microservice
    elif args.service_type == "OUTLIER_DETECTOR":
        import outlier_detector_microservice as seldon_microservice

    port = int(os.environ.get(SERVICE_PORT_ENV_NAME, DEFAULT_PORT))

    if args.api_type == "REST":
        app = seldon_microservice.get_rest_microservice(user_object,
                                                        debug=DEBUG)
        app.run(host='0.0.0.0', port=port)

    elif args.api_type == "GRPC":
        server = seldon_microservice.get_grpc_server(user_object, debug=DEBUG)
        server.add_insecure_port("0.0.0.0:{}".format(port))
        server.start()

        print("GRPC Microservice Running on port {}".format(port))
        while True:
            time.sleep(1000)

    elif args.api_type == "FBS":
        seldon_microservice.run_flatbuffers_server(user_object, port)
Exemplo n.º 2
0
 def fbs_prediction_server():
     seldon_microservice.run_flatbuffers_server(user_object, port)