-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel_metadata.java
executable file
·29 lines (24 loc) · 1.06 KB
/
model_metadata.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17+
//DEPS io.github.tadayosi.tensorflow:tensorflow-serving-client:0.2.0
//DEPS org.slf4j:slf4j-simple:2.0.16
import io.github.tadayosi.tensorflow.serving.client.TensorFlowServingClient;
import com.google.protobuf.Int64Value;
import tensorflow.serving.GetModelMetadata.GetModelMetadataRequest;
import tensorflow.serving.Model.ModelSpec;
public class model_metadata {
public static void main(String... args) throws Exception {
try (var client = TensorFlowServingClient.newInstance()) {
var request = GetModelMetadataRequest.newBuilder()
.setModelSpec(ModelSpec.newBuilder()
.setName("half_plus_two")
.setVersion(Int64Value.of(123)))
// metadata_field is mandatory
.addMetadataField("signature_def")
.build();
var response = client.getModelMetadata(request);
System.out.println("Response>");
System.out.println(response);
}
}
}