Commit 8b455ed 1 parent c1b1bb6 commit 8b455ed Copy full SHA for 8b455ed
File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 7
7
import java .nio .file .Files ;
8
8
import java .nio .file .Path ;
9
9
10
- import com .github .tadayosi .torchserve .client .impl . DefaultInference ;
10
+ import com .github .tadayosi .torchserve .client .TorchServeClient ;
11
11
import com .github .tadayosi .torchserve .client .model .ApiException ;
12
12
13
13
public class mnist {
@@ -18,10 +18,10 @@ public static void main(String... args) throws Exception {
18
18
var zero = Files .readAllBytes (Path .of ("src/test/resources/data/0.png" ));
19
19
var one = Files .readAllBytes (Path .of ("src/test/resources/data/1.png" ));
20
20
try {
21
- var inference = new DefaultInference ();
22
- var result0 = inference .predictions (MNIST_MODEL , zero );
21
+ var client = TorchServeClient . newInstance ();
22
+ var result0 = client . inference () .predictions (MNIST_MODEL , zero );
23
23
System .out .println ("Answer> " + result0 );
24
- var result1 = inference .predictions (MNIST_MODEL , one );
24
+ var result1 = client . inference () .predictions (MNIST_MODEL , one );
25
25
System .out .println ("Answer> " + result1 );
26
26
} catch (ApiException e ) {
27
27
e .printStackTrace ();
Original file line number Diff line number Diff line change 4
4
//REPOS mavencentral,jitpack=https://jitpack.io
5
5
//DEPS com.github.tadayosi:torchserve-client-java:main-SNAPSHOT
6
6
7
- import com .github .tadayosi .torchserve .client .impl . DefaultManagement ;
7
+ import com .github .tadayosi .torchserve .client .TorchServeClient ;
8
8
import com .github .tadayosi .torchserve .client .model .ApiException ;
9
9
import com .github .tadayosi .torchserve .client .model .RegisterModelOptions ;
10
10
import com .github .tadayosi .torchserve .client .model .SetAutoScaleOptions ;
@@ -16,10 +16,10 @@ public class register_mnist {
16
16
17
17
public static void main (String ... args ) throws Exception {
18
18
try {
19
- var management = new DefaultManagement ();
20
- var response = management .registerModel (MNIST_URL , RegisterModelOptions .empty ());
19
+ var client = TorchServeClient . newInstance ();
20
+ var response = client . management () .registerModel (MNIST_URL , RegisterModelOptions .empty ());
21
21
System .out .println ("registerModel> " + response .getStatus ());
22
- response = management .setAutoScale (MNIST_MODEL , SetAutoScaleOptions .builder ()
22
+ response = client . management () .setAutoScale (MNIST_MODEL , SetAutoScaleOptions .builder ()
23
23
.minWorker (1 )
24
24
.maxWorker (1 )
25
25
.build ());
You can’t perform that action at this time.
0 commit comments