部署架构
工作时序图
推理接口
-
单笔推理
http方式 ValidateController.validate
Java SDK方式
-
批量推理
http方式 ValidateController.validate
Java SDK方式
SDK代码示例
RegisterClientExample.java
public static void main(String[] args) throws IOException, InterruptedException {
InferenceRequest inferenceRequest = buildInferenceRequest();
BatchInferenceRequest batchInferenceRequest = buildBatchInferenceRequest();
try {
/**
* 测试单笔预测
*/
ReturnResult returnResult1 = client.singleInference(inferenceRequest);
System.err.println(returnResult1);
/**
* 使用注册中心的同时也可以绕过注册中心,使用ip端口的方式进行rpc调用
*/
ReturnResult returnResult2 = client.singleInference("localhost",8000,inferenceRequest);
System.err.println(returnResult2);
/**
* 测试批量预测
*/
BatchInferenceResult BatchInferenceResult1 = client.batchInference(batchInferenceRequest);
System.err.println(BatchInferenceResult1);
/**
* 指定ip端口批量预测
*/
BatchInferenceResult BatchInferenceResult2 = client.batchInference("localhost",8000,batchInferenceRequest);
System.err.println(BatchInferenceResult2);
} catch (Exception e) {
e.printStackTrace();
}
System.err.println("over");
}
参考
https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/FATE-SERVING-2.0.html