91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 321KB
    文件類型: .gz
    金幣: 1
    下載: 1 次
    發布日期: 2021-08-14
  • 語言: Java
  • 標簽: grpc??java??python??

資源簡介

GRPC簡單應用(Java+Python),java和python版本的grpc調用實現,附文檔

資源截圖

代碼片段和文件信息

/*
?*?Copyright?2015?gRPC?Authors?All?rights?reserved.
?*
?*?Licensed?under?the?Apache?License?Version?2.0?(the?“License“);
?*?you?may?not?use?this?file?except?in?compliance?with?the?License.
?*?You?may?obtain?a?copy?of?the?License?at
?*
?*?????http://www.apache.org/licenses/LICENSE-2.0
?*
?*?Unless?required?by?applicable?law?or?agreed?to?in?writing?software
?*?distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
?*?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
?*?See?the?License?for?the?specific?language?governing?permissions?and
?*?limitations?under?the?License.
?*/

package?com.taidi.nlp.ner.grpc;

import?java.util.Arrays;
import?java.util.List;
import?java.util.concurrent.TimeUnit;
import?java.util.logging.Level;
import?java.util.logging.Logger;

import?com.taidi.nlp.ner.grpc.DeepNerRequest.Builder;

import?io.grpc.ManagedChannel;
import?io.grpc.ManagedChannelBuilder;
import?io.grpc.StatusRuntimeException;

/**
?*?A?simple?client?that?requests?a?greeting?from?the?{@link?HelloWorldServer}.
?*/
public?class?DeepNerClient?{
??private?static?final?Logger?logger?=?Logger.getLogger(DeepNerClient.class.getName());

??private?final?ManagedChannel?channel;
??private?final?QueryRpcGrpc.QueryRpcBlockingStub?blockingStub;

??/**?Construct?client?connecting?to?HelloWorld?server?at?{@code?host:port}.?*/
??public?DeepNerClient(String?host?int?port)?{
????this(ManagedChannelBuilder.forAddress(host?port)
????????//?Channels?are?secure?by?default?(via?SSL/TLS).?For?the?example?we?disable?TLS?to?avoid
????????//?needing?certificates.
????????.usePlaintext(true)
????????.build());
??}

??/**?Construct?client?for?accessing?RouteGuide?server?using?the?existing?channel.?*/
??DeepNerClient(ManagedChannel?channel)?{
????this.channel?=?channel;
????blockingStub?=?QueryRpcGrpc.newBlockingStub(channel);
??}

??public?void?shutdown()?throws?InterruptedException?{
????channel.shutdown().awaitTermination(5?TimeUnit.SECONDS);
??}

??/**?Say?hello?to?server.?*/
??public?void?query(String?name)?{
????logger.info(“Will?try?to?greet?“?+?name?+?“?...“);
????Builder?request?=?DeepNerRequest.newBuilder();
????request.setQuery(“聽聽他們的歌“);
????request.setDomain(“music“);
????String[]?str?=?{“False?song?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False“
????????????????????“False?song?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False?False“
????????????????????“False?song?False?anaphor?False?False?album?False?False?False?False?False?anaphor_song?False?False?False?False?False?False?False?False“
????????????????????“False?song?False?anaphor?False?False?album?False?False?False?False?False?anaphor_song?False?False?False?False?False?False?False?False“
????????????????????“False?False?False?anaphor?False?False?False?False?False?False?False?False?anaphor_song?False?False?False?False?False?False?False?False“
??????????????

評論

共有 條評論