https://github.com/redisai/jredisai
Java client for RedisAI
https://github.com/redisai/jredisai
java-client onnxruntime pytorch redisai tensorflow
Last synced: about 1 month ago
JSON representation
Java client for RedisAI
- Host: GitHub
- URL: https://github.com/redisai/jredisai
- Owner: RedisAI
- License: bsd-3-clause
- Created: 2019-01-21T15:59:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-03T18:52:24.000Z (8 months ago)
- Last Synced: 2025-03-25T05:36:39.400Z (about 2 months ago)
- Topics: java-client, onnxruntime, pytorch, redisai, tensorflow
- Language: Java
- Homepage: https://redisai.io
- Size: 26.9 MB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/RedisAI/JRedisAI)
[](https://circleci.com/gh/RedisAI/JRedisAI/tree/master)
[](https://github.com/RedisAI/JRedisAI/releases/latest)
[](https://maven-badges.herokuapp.com/maven-central/com.redislabs/jredisai)
[](https://www.javadoc.io/doc/com.redislabs/jredisai)
[](https://codecov.io/gh/RedisAI/JRedisAI)
[](https://lgtm.com/projects/g/RedisAI/JRedisAI/context:java)
[](https://snyk.io/test/github/RedisAI/JRedisAI?targetFile=pom.xml)# JRedisAI
[](https://forum.redislabs.com/c/modules/redisai)
[](https://discord.gg/rTQm7UZ)Java client for RedisAI
### Official Releases
```xml
com.redislabs
jredisai
0.9.0
```### Snapshots
```xml
snapshots-repo
https://oss.sonatype.org/content/repositories/snapshots
```and
```xml
com.redislabs
jredisai
1.0.0-SNAPSHOT
```# Example: Using the Java Client
```java
RedisAI client = new RedisAI("localhost", 6379);
client.setModel("model", Backend.TF, Device.CPU, new String[] {"a", "b"}, new String[] {"mul"}, "graph.pb");
client.setTensor("a", new float[] {2, 3}, new int[]{2});
client.setTensor("b", new float[] {2, 3}, new int[]{2});client.runModel("model", new String[] {"a", "b"}, new String[] {"c"});
```## Note
**Chunk size:** Since version `0.10.0`, the chunk size of model (blob) is set to 512mb (536870912 bytes) based on
default Redis configuration. This behavior can be changed by `redisai.blob.chunkSize` system property at the beginning
of the application. For example, chunk size can be limited to 8mb by setting `-Dredisai.blob.chunkSize=8388608` or
`System.setProperty(Model.BLOB_CHUNK_SIZE_PROPERTY, "8388608");`. A limit of 0 (zero) would disable chunking.**Socket timeout:** Operations with large data and/or long processing time may require a higher socket timeout.
Following constructor may come in handy for that purpose.
```
HostAndPort hostAndPort = new HostAndPort(host, port);
JedisClientConfig clientConfig = DefaultJedisClientConfig.builder().socketTimeoutMillis(largeTimeout).build();
new RedisAI(hostAndPort, clientConfig);
```