Files
annotations/Azaion.AI/remote_command.pyx
T
Alex Bezdieniezhnykh 62623b7123 add ramdisk, load AI model to ramdisk and start recognition from it
rewrite zmq to DEALER and ROUTER
add GET_USER command to get CurrentUser from Python
all auth is on the python side
inference run and validate annotations on python
2025-01-29 17:45:26 +02:00

22 lines
741 B
Cython

import msgpack
cdef class RemoteCommand:
def __init__(self, CommandType command_type, str filename, bytes data):
self.command_type = command_type
self.filename = filename
self.data = data
def __str__(self):
command_type_names = {
1: "INFERENCE",
2: "LOAD",
3: "GET_USER"
}
data_str = f'. Data: {len(self.data)} bytes' if self.data else ''
return f'{command_type_names[self.command_type]}: {self.filename}{data_str}'
@staticmethod
cdef from_msgpack(bytes data):
unpacked = msgpack.unpackb(data, strict_map_key=False)
return RemoteCommand(unpacked.get("CommandType"), unpacked.get("Filename"), unpacked.get("Data"))