How to use the redisai.utils.list2dict 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 / postprocessor.py View on Github external
def infoget(res):
        return utils.list2dict(res)
github RedisAI / redisai-py / redisai / client.py View on Github external
If True, only the meta data will be fetched, not the model blob

        Returns
        -------
        dict
            A dictionary of model details such as device, backend etc. The model
            blob will be available at the key 'blob'

        Example
        -------
        >>> con.modelget('model', meta_only=True)
        {'backend': 'TF', 'device': 'cpu', 'tag': 'v1.0'}
        """
        args = builder.modelget(key, meta_only)
        rv = self.execute_command(*args)
        return utils.list2dict(rv)
github RedisAI / redisai-py / redisai / postprocessor.py View on Github external
def scriptget(res):
        return utils.list2dict(res)
github RedisAI / redisai-py / redisai / client.py View on Github external
Model key

        Returns
        -------
        dict
            Dictionary of model run details

        Example
        -------
        >>> con.infoget('m')
        {'key': 'm', 'type': 'MODEL', 'backend': 'TF', 'device': 'cpu', 'tag': '',
        'duration': 0, 'samples': 0, 'calls': 0, 'errors': 0}
        """
        args = builder.infoget(key)
        ret = self.execute_command(*args)
        return utils.list2dict(ret)
github RedisAI / redisai-py / redisai / postprocessor.py View on Github external
def tensorget(res, as_numpy, meta_only):
        """Process the tensorget output.

        If ``as_numpy`` is True, it'll be converted to a numpy array. The required
        information such as datatype and shape must be in ``rai_result`` itself.
        """
        rai_result = utils.list2dict(res)
        if meta_only:
            return rai_result
        elif as_numpy is True:
            return utils.blob2numpy(rai_result['blob'], rai_result['shape'], rai_result['dtype'])
        else:
            target = float if rai_result['dtype'] in ('FLOAT', 'DOUBLE') else int
            utils.recursive_bytetransform(rai_result['values'], target)
            return rai_result