import abc
import typing
import grpclib.const
import grpclib.client
import grpclib.exceptions
if typing.TYPE_CHECKING:
import grpclib.server
from .... import common
import google.api.annotations_pb2
import google.protobuf.struct_pb2
from .... import service
[docs]
class MLModelServiceBase(abc.ABC):
[docs]
@abc.abstractmethod
async def Infer(self, stream: 'grpclib.server.Stream[service.mlmodel.v1.mlmodel_pb2.InferRequest, service.mlmodel.v1.mlmodel_pb2.InferResponse]') -> None:
pass
[docs]
@abc.abstractmethod
async def GetStatus(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetStatusRequest, common.v1.common_pb2.GetStatusResponse]') -> None:
pass
[docs]
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
return {'/viam.service.mlmodel.v1.MLModelService/Infer': grpclib.const.Handler(self.Infer, grpclib.const.Cardinality.UNARY_UNARY, service.mlmodel.v1.mlmodel_pb2.InferRequest, service.mlmodel.v1.mlmodel_pb2.InferResponse), '/viam.service.mlmodel.v1.MLModelService/Metadata': grpclib.const.Handler(self.Metadata, grpclib.const.Cardinality.UNARY_UNARY, service.mlmodel.v1.mlmodel_pb2.MetadataRequest, service.mlmodel.v1.mlmodel_pb2.MetadataResponse), '/viam.service.mlmodel.v1.MLModelService/GetStatus': grpclib.const.Handler(self.GetStatus, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetStatusRequest, common.v1.common_pb2.GetStatusResponse)}
[docs]
class UnimplementedMLModelServiceBase(MLModelServiceBase):
[docs]
async def Infer(self, stream: 'grpclib.server.Stream[service.mlmodel.v1.mlmodel_pb2.InferRequest, service.mlmodel.v1.mlmodel_pb2.InferResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs]
async def GetStatus(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetStatusRequest, common.v1.common_pb2.GetStatusResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs]
class MLModelServiceStub:
def __init__(self, channel: grpclib.client.Channel) -> None:
self.Infer = grpclib.client.UnaryUnaryMethod(channel, '/viam.service.mlmodel.v1.MLModelService/Infer', service.mlmodel.v1.mlmodel_pb2.InferRequest, service.mlmodel.v1.mlmodel_pb2.InferResponse)
self.Metadata = grpclib.client.UnaryUnaryMethod(channel, '/viam.service.mlmodel.v1.MLModelService/Metadata', service.mlmodel.v1.mlmodel_pb2.MetadataRequest, service.mlmodel.v1.mlmodel_pb2.MetadataResponse)
self.GetStatus = grpclib.client.UnaryUnaryMethod(channel, '/viam.service.mlmodel.v1.MLModelService/GetStatus', common.v1.common_pb2.GetStatusRequest, common.v1.common_pb2.GetStatusResponse)