<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Taip調(diào)用騰訊 AI 接口的 Java 客戶端

          聯(lián)合創(chuàng)作 · 2023-09-30 10:15

          TAIP 是調(diào)用騰訊 AI 接口的 Java 客戶端,為調(diào)用騰訊 AI 功能的開發(fā)人員提供了一系列的交互方法。

          目前已經(jīng)接入

          【face人臉識別】

          • 人臉檢測與分析、多人臉檢測、人臉對比、跨年齡人臉識別、五官定位、人臉識別、人臉驗證、個體創(chuàng)建、刪除個體、增加人臉、刪除人臉、設(shè)置信息、獲取信息、獲取組列表、獲取個體列表、獲取人臉列表、獲取人臉信息接口調(diào)用服務(wù)

          【ptu圖片特效】

          • 人臉美妝、人臉變妝、圖片濾鏡(天天P圖)、圖片濾鏡(AI Lab)、人臉融合、大頭貼、顏齡檢測接口調(diào)用服務(wù)

          自然語言處理TAipNlp】

          • ( 分詞、詞性標注、專有名詞識別、同義詞識別、意圖成分識別、情感分析、基礎(chǔ)閑聊、文本翻譯(AI Lab)、文本翻譯(翻譯君)、圖片翻譯 、語音翻譯、語種識別 )接口調(diào)用服務(wù)

          智能鑒黃、暴恐圖片識別TAipVision】

          • ( 智能鑒黃、暴恐圖片識別)接口調(diào)用服務(wù)

          語音合成、識別TAipSpeech】

          • (語音識別-echo版、語音識別-流式版(AI Lab)、語音識別-流式版(WeChat AI)、長語音識別、語音合成(AI Lab)、語音合成(優(yōu)圖))接口調(diào)用服務(wù)

          文字識別TAipOcr】

          • (身份證識別、名片識別、行駛證駕駛證識別、營業(yè)執(zhí)照識別、銀行卡識別、通用OCR識別)接口調(diào)用服務(wù)

          圖像識別TAipImageClassify】

          • (物體場景識別、圖片標簽識別、花草/車輛識別、看圖說話、模糊圖片檢測、美食圖片識別)接口調(diào)用服務(wù)

          Java JDK 1.7+

          • 項目結(jié)構(gòu)介紹

          cn.xsshome.taip
                 ├── base                                //基類
                 ├── http                                //Http通信相關(guān)類
                 ├── error                                //SDK錯誤類
                 ├── imageclassify
                 │       └── TAipImageClassify           //TAipImageClassify類
                 ├── sign                                //簽名公用類
                 ├── ocr
                 │       └── TAipOcr                      //TAipOcr類
                 ├── speech
                 │       └── TAipSpeech                   //TAipSpeech類
                 ├── face
                 │       └── TAipFace                   //TAipFace類
                 ├── ptu
                 │       └── TAipPtu                   //TAipPtu類
                 ├── nlp
                 │       └── TAipNlp                   //TAipNlp類
                 ├── vision
                 │       └── TAipVision                   //TAipVision類
                 └── util                                //工具類
          • 使用 maven 引入即可(最新版本4.2.2)

          • OCR 示例代碼

          TAipOcr 是調(diào)用騰訊 AI 中 OCR 的 Java 客戶端,為調(diào)用騰訊 AI 中 OCR 功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個 TAipOcr,初始化完成后建議單例使用:

          public class Sample {
              //設(shè)置APPID/APP_KEY
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
          
              public static void main(String[] args) {
                  // 初始化一個TAipOcr
                 TAipOcr aipOcr = new TAipOcr(APP_ID,APP_KEY);
                  // 調(diào)用接口
                  String result = aipOcr.idcardOcr("./idcard.jpg", 0);//身份證正面(圖片)識別
                  String result = aipOcr.idcardOcr("./idcard2.jpg", 1);//身份證反面(國徽)識別
                  String result = aipOcr.bcOcr("./juli2.jpg");//名片識別
                  String result = aipOcr.driverlicenseOcr("./driver.jpg",0);//行駛證OCR識別
                  String result = aipOcr.driverlicenseOcr("./driver2.jpg",1);//駕駛證OCR識別
                  String result = aipOcr.bizlicenseOcr("./biz.jpg");//營業(yè)執(zhí)照OCR識別
                  String result = aipOcr.creditcardOcr("./bank2.jpg");//銀行卡OCR識別
                  String result = aipOcr.generalOcr("./biz.jpg");//通用OCR識別
              }
          }
          • ASR、TTS 示例代碼

          新建TAipSpeech TAipSpeech是調(diào)用騰訊AI中語音識別、合成的Java客戶端,為調(diào)用騰訊AI中語音識別、合成功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個TAipSpeech,初始化完成后建議單例使用:

          public class Sample {
              //設(shè)置APPID/APP_KEY
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
          
              public static void main(String[] args) {
                  // 初始化一個TAipSpeech
                  TAipSpeech aipSpeech = new TAipSpeech(APP_ID, APP_KEY);
                  // 調(diào)用接口
                  String filePath ="./VOICE1513237078.pcm";//本地文件路徑
                  byte[] audio = FileUtil.readFileByBytes(filePath);//獲取文件的byte數(shù)據(jù)
                  String result = aipSpeech.asrEcho(filePath, 1);//語音識別-echo版
                  String result = aipSpeech.asrLab(1, 16000, 0, 1024, 1, audio);//語音識別-流式版(AI Lab)
                  String result = aipSpeech.asrWx(filePath, 1, 16000, 16, 0, 1024, 1, 1);//語音識別-流式版(WeChat AI)
                  String text = "小帥封裝代碼";
                  String result = aipSpeech.TtaSynthesis(text);//語音合成(優(yōu)圖)     默認參數(shù)
                  String result = aipSpeech.TtaSynthesis(text,2,1);//語音合成(優(yōu)圖)     全部參數(shù)
                  String result = aipSpeech.TtsSynthesis(text, 1, 3);//語音合成(AI Lab) 默認參數(shù)
                  String result = aipSpeech.TtsSynthesis(text,1,3,0,100,0,58);//語音合成(AI Lab) 全部參數(shù)
                  String result = aipSpeech.asrLong("G:/16.pcm", 1, "http://yourwebsitename.com/methodname");//長語音識別
                  System.out.println(result);
              }
          }

           

          • 圖像識別 示例代碼

          TAipImageClassify是調(diào)用騰訊AI中圖像識別的Java客戶端,為調(diào)用騰訊AI中圖像識別功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個 TAipImageClassify,初始化完成后建議單例使用:

          public class Sample {
              //設(shè)置APPID/APP_KEY
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
              public static void main(String[] args) throws Exception {
                  // 初始化一個TAipImageClassify
                  TAipImageClassify aipImageClassify = new TAipImageClassify(APP_ID, APP_KEY);
                  String filePath = "G:/x5.jpg";//本地文件路徑
                  byte[] image = FileUtil.readFileByBytes(filePath);//獲取文件的byte數(shù)據(jù)
                  String result = aipImageClassify.visionScener(image, 1, 5);//場景識別
                  String result = aipImageClassify.visionObjectr(image, 1, 5);//物體識別
                  String result = aipImageClassify.imageTag(image);//圖像標簽識別
                  String result = aipImageClassify.visionImgidentify(image, 1);//車輛識別
                  String result = aipImageClassify.visionImgidentify(image, 2);//花草識別
                  String result = aipImageClassify.flowersAndPlant(image);//花草識別
                  String result = aipImageClassify.vehicle(image);//車輛識別
                  String result = aipImageClassify.visionImgtotext(image,RandomNonceStrUtil.getRandomString());//看圖說話
                  String result = aipImageClassify.imageFuzzy(image);//模糊圖片檢測    
                  String result = aipImageClassify.imageFood(image);//美食圖片識別    
                  System.out.println(result);
                  
              }
          }
          • 人臉識別 示例代碼

          TAipFace是調(diào)用騰訊AI中人臉識別的Java客戶端,為調(diào)用騰訊AI中人臉識別功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個 TAipFace,初始化完成后建議單例使用:

          public class Sample{
           //設(shè)置APPID/APP_KEY
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
              public static void main(String[] args) throws Exception {
                   // 初始化一個TAipPtu
                  TAipFace aipFace = new TAipFace(APP_ID, APP_KEY);
                  String filePath = "G:/body2.jpg";
                  String filePathA = "G:/dc.jpg";
                  String filePathB = "G:/dcg.jpg";
                  /**********人臉識別**********/
                  String result = aipFace.detect(filePath);//人臉檢測與分析
                  String result = aipFace.detectMulti(filePath);    //多人臉檢測
                  String result = aipFace.faceCompare(filePathA, filePathB);    //人臉對比     
                  String result = aipFace.detectCrossage(filePathA, filePathB);//跨年齡人臉識別
                  String result = aipFace.faceShape(filePathA);//五官定位     
                  String result = aipFace.faceIdentify(filePath, "group01", 9);//人臉識別
                  String result = aipFace.faceVerify(filePath, "20180511");//人臉驗證
                  /**********個體管理**********/
                  String result = aipFace.faceNewperson(filePath,"group20180511","201805110001","測試");//個體創(chuàng)建
                  String result = aipFace.faceDelperson("201805110001");//刪除個體
                  /*增加人臉 圖片二進制List*/
                  List bytes = new ArrayList();
                  byte [] faceA = FileUtil.readFileByBytes(filePathA);
                  byte [] faceB = FileUtil.readFileByBytes(filePathB);
                  bytes.add(faceA);
                  bytes.add(faceB);
                  String result = aipFace.faceAddfaceByte(bytes,"201805110001","測試增加人臉");
                  /*增加人臉 圖片本地路徑List*/
                  List filePaths = new ArrayList();
                  filePaths.add(filePathA);
                  filePaths.add(filePathB);
                  String result = aipFace.faceAddfaceByFilePath(filePaths,"201805110001","測試增加人臉");//增加人臉
                  String result = aipFace.faceDelFace("201805110001", "2573556034542000336");//刪除人臉
                  String result = aipFace.faceSetInfo("201805110001", "小帥測試","測試接口");//設(shè)置信息
                  String result = aipFace.faceGetInfo("201805110001");//獲取信息
                  /**********信息查詢**********/
                  String result = aipFace.getGroupIds();//獲取組列表
                  String result = aipFace.getPersonIds("group20180511");//獲取個體列表
                  String result = aipFace.getFaceIds("201805110001");//獲取人臉列表
                  String result = aipFace.getFaceInfo("2573564663139686751");//獲取人臉信息     
                  System.out.println(result);
              }
          }
          • 圖片特效 示例代碼

          TAipPtu是調(diào)用騰訊AI中圖片特效的Java客戶端,為調(diào)用騰訊AI中圖片特效功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個 TAipPtu,初始化完成后建議單例使用:

          public class Sample{
               //設(shè)置APPID/APP_KEY
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
              public static void main(String[] args) throws Exception {
                  // 初始化一個TAipPtu
                  TAipPtu aipPtu = new TAipPtu(APP_ID, APP_KEY);
                  String imagePath = "G:/test2.jpg";
                  String result = aipPtu.faceCosmetic(imagePath, 23);//人臉美妝     
                  String result = aipPtu.faceDecoration(imagePath, 8);//人臉變妝     
                  String result = aipPtu.imgFilter(imagePath, 20);//濾鏡 天天P圖     
                  String result = aipPtu.visionImgfilter(imagePath, 32, String.valueOf(new Date().getTime()));//濾鏡 AI Lab
                  String result = aipPtu.faceMerge(imagePath, 12);//人臉融合
                  String result = aipPtu.faceSticker(imagePath, 27);//大頭貼
                  String result = aipPtu.faceAge(imagePath);//顏齡檢測
                  System.out.println(result);
              }
          }
          • 自然語言處理

          TAipNlp是調(diào)用騰訊AI中自然語言處理的Java客戶端,為調(diào)用騰訊AI中自然語言處理功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個 TAipNlp,初始化完成后建議單例使用:

          public class Sample{
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
              public static void main2(String[] args) throws Exception {
                  TAipNlp aipNlp = new TAipNlp(APP_ID, APP_KEY);
                  String session = new Date().getTime()/1000+"";
                  String filePath = "G:/tt.jpg";
                  String filePath2 = "G:/16.pcm";
                  String result = aipNlp.nlpWordseg("小帥開發(fā)者");//分詞
                  String result = aipNlp.nlpWordpos("小帥是一個熱心的開發(fā)者");//詞性標注
                  String result = aipNlp.nlpWordner("最近張學(xué)友在深圳開了一場演唱會");//專有名詞
                  String result = aipNlp.nlpWordsyn("今天的天氣怎么樣");//同義詞
                  String result = aipNlp.nlpWordcom("今天深圳的天氣怎么樣?明天呢");//意圖成分
                  String result = aipNlp.nlpTextpolar("小帥很帥");//情感分析
                  String result = aipNlp.nlpTextchat(session,"北京天氣");//基礎(chǔ)閑聊     
                  String result = aipNlp.nlpTextTrans(0, "小帥開發(fā)者");//文本翻譯(AI Lab)
                  String result = aipNlp.nlpTextTranslate("小帥開發(fā)者", "zh", "en");//文本翻譯(翻譯君)     
                  String result = aipNlp.nlpImageTranslate(filePath, session, "doc","zh", "en");//圖片翻譯
                  String result = aipNlp.nlpSpeechTranslate(6, 0, 1, session, filePath2,"zh", "en");//語音翻譯     
                  String result = aipNlp.nlpTextDetect("こんにちは", 0);//語種識別
                  System.out.println(result);
              }
          }
          • 智能鑒黃、暴恐圖片識別

          TAipVision是調(diào)用騰訊AI中智能鑒黃、暴恐圖片識別的Java客戶端,為調(diào)用騰訊AI中智能鑒黃、暴恐圖片識別功能的開發(fā)人員提供了一系列的交互方法。

          用戶可以參考如下代碼新建一個 TAipVision,初始化完成后建議單例使用:

          public class Sample{
              public static final String APP_ID = "你的 App ID";
              public static final String APP_KEY = "你的 Api Key";
              public static void main2(String[] args) throws Exception {
                  TAipVision aipVision = new TAipVision(APP_ID, APP_KEY);
                  String filePath = "G:/tt.jpg";
                  String result = aipVision.imageTerrorism(filePath);//暴恐圖片
                  String result = aipVision.visionPorn(filePath);//智能鑒黃
                  System.out.println(result);
              }
          }

           

          瀏覽 24
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产精品51麻豆cm传媒 | a毛一级a一级a免费观看视频 | 枕瑶钗十三回兴云弄雨又春风 | 蜜桃精品视频在线观看 | 一级欧美a片 |