Created
May 20, 2020 18:34
-
-
Save guyroyse/5864706e28e30007b11a5b6d8e1eb75c to your computer and use it in GitHub Desktop.
Using RedisAI from ioredis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let redis = new Redis() | |
async function classinate(values) { | |
await redis.call( | |
'AI.TENSORSET', 'model:in', | |
'DOUBLE', '1', '10', | |
'VALUES', ...values) | |
await redis.call( | |
'AI.MODELRUN', 'models:gmsc:linearsvc', 'INPUTS', 'model:in', | |
'OUTPUTS', 'model:out:prediction', 'model:out:score') | |
let classification = await redis.call( | |
'AI.TENSORGET', 'model:out:prediction', 'VALUES') | |
return classification[0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment