How to use the redisai.utils.listify function in redisai

To help you get started, we’ve selected a few redisai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RedisAI / redisai-py / redisai / command_builder.py View on Github external
def modelrun(name: AnyStr, inputs: List[AnyStr], outputs: List[AnyStr]) -> Sequence:
    args = ('AI.MODELRUN', name, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
            *utils.listify(outputs))
    return args
github RedisAI / redisai-py / redisai / command_builder.py View on Github external
if backend.upper() not in utils.allowed_backends:
        raise ValueError(f"Backend not allowed. Use any from {utils.allowed_backends}")
    args = ['AI.MODELSET', name, backend, device]

    if batch is not None:
        args += ['BATCHSIZE', batch]
    if minbatch is not None:
        args += ['MINBATCHSIZE', minbatch]
    if tag is not None:
        args += ['TAG', tag]

    if backend.upper() == 'TF':
        if not(all((inputs, outputs))):
            raise ValueError(
                'Require keyword arguments input and output for TF models')
        args += ['INPUTS', *utils.listify(inputs)]
        args += ['OUTPUTS', *utils.listify(outputs)]
    chunk_size = 500 * 1024 * 1024
    data_chunks = [data[i:i + chunk_size] for i in range(0, len(data), chunk_size)]
    # TODO: need a test case for this
    args += ['BLOB', *data_chunks]
    return args
github RedisAI / redisai-py / redisai / command_builder.py View on Github external
raise ValueError(f"Backend not allowed. Use any from {utils.allowed_backends}")
    args = ['AI.MODELSET', name, backend, device]

    if batch is not None:
        args += ['BATCHSIZE', batch]
    if minbatch is not None:
        args += ['MINBATCHSIZE', minbatch]
    if tag is not None:
        args += ['TAG', tag]

    if backend.upper() == 'TF':
        if not(all((inputs, outputs))):
            raise ValueError(
                'Require keyword arguments input and output for TF models')
        args += ['INPUTS', *utils.listify(inputs)]
        args += ['OUTPUTS', *utils.listify(outputs)]
    chunk_size = 500 * 1024 * 1024
    data_chunks = [data[i:i + chunk_size] for i in range(0, len(data), chunk_size)]
    # TODO: need a test case for this
    args += ['BLOB', *data_chunks]
    return args
github RedisAI / redisai-py / redisai / command_builder.py View on Github external
def scriptrun(name: AnyStr,
              function: AnyStr,
              inputs: Union[AnyStr, Sequence[AnyStr]],
              outputs: Union[AnyStr, Sequence[AnyStr]]
              ) -> Sequence:
    args = ('AI.SCRIPTRUN', name, function, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
            *utils.listify(outputs))
    return args
github RedisAI / redisai-py / redisai / command_builder.py View on Github external
def scriptrun(name: AnyStr,
              function: AnyStr,
              inputs: Union[AnyStr, Sequence[AnyStr]],
              outputs: Union[AnyStr, Sequence[AnyStr]]
              ) -> Sequence:
    args = ('AI.SCRIPTRUN', name, function, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
            *utils.listify(outputs))
    return args
github RedisAI / redisai-py / redisai / command_builder.py View on Github external
def modelrun(name: AnyStr, inputs: List[AnyStr], outputs: List[AnyStr]) -> Sequence:
    args = ('AI.MODELRUN', name, 'INPUTS', *utils.listify(inputs), 'OUTPUTS',
            *utils.listify(outputs))
    return args