Fx.AI

Fx.AI:处理AI相关的API

1. 图片识别

Fx.AI.detectPic(<String modelId>, <String path>)

参数说明

参数 类型 说明
modelId String 物体识别模型唯一ID
path String 图片路径

返回值类型

APIResult

返回值说明

Map(返回图片识别的产品数据) 返回值例: {"path":"N_202006_09_87e2be5f5c364bda9cb5ed61a21ddd25","objectList":[{"apiName":"ProductObj","dataId":"5d3bbf1e7cfed965a54daf70","position":{"x":532.0,"y":756.0,"w":78.0,"h":146.0},"score":"0.9921149611473083","color":"C91F25"},{"apiName":"ProductObj","dataId":"5d3bbf1e7cfed965a54daf72","position":{"x":220.0,"y":761.0,"w":86.0,"h":72.0},"score":"0.9953563809394836","color":"3DD4C4"},{"apiName":"ProductObj","dataId":"5d3bbf1e7cfed965a54daf72","position":{"x":327.0,"y":840.0,"w":82.0,"h":62.0},"score":"0.9940695762634277","color":"3DD4C4"},{"apiName":"ProductObj","dataId":"5d3bbe347cfed965a54dacb7","position":{"x":475.0,"y":942.0,"w":81.0,"h":77.0},"score":"0.9963515996932983","color":"3F3F98"}]}

Java举例

APIResult ret = Fx.AI.detectPic("5dabce96e75d9594e1dc05f6", "N_202006_09_87e2be5f5c364bda9cb5ed61a21ddd25");

Groovy举例

def ret = Fx.AI.detectPic("5dabce96e75d9594e1dc05f6", "N_202006_09_87e2be5f5c364bda9cb5ed61a21ddd25")

注意事项

  • 企业有模型才可以使用

2. 发票验真

Fx.AI.invoiceValidation(<InvoiceData invoice>)

参数说明

参数 类型 说明
invoice InvoiceData 详见以下说明

返回值类型

APIResult

返回值说明

需要验证的发票信息,包括: 发票类型 ; 发票代码; 发票号码; 发票日期; 发票金额; 发票校验码后6位; 支持的发票类型 增值税专用发票:special_vat_invoice 增值税电子专用发票:elec_special_vat_invoice 增值税普通发票:normal_invoice 增值税普通发票(电子):elec_normal_invoice 增值税普通发票(卷式):roll_normal_invoice 通行费增值税电子普通发票:toll_elec_normal_invoice 货运运输业增值税专用发票:special_freight_transport_invoice 机动车销售发票:motor_vehicle_invoice 二手车销售发票:used_vehicle_invoice

Java举例

InvoiceData invoice = InvoiceData.builder()
     .type("elec_normal_invoice")
     .code("011002100511")
     .number("24830566")
     .date("20210620")
     .amount("339.62")
     .checkCode("957725")
     .build();

APIResult ret = Fx.AI.invoiceValidation(invoice);
if (ret.isError()) {
     log.info(ret.message());
} else {
     log.info("success!");
}

Groovy举例

InvoiceData invoice = InvoiceData.builder()
     .type("elec_normal_invoice")
     .code("011002100511")
     .number("24830566")
     .date("20210620")
     .amount("339.62")
     .checkCode("957725")
     .build()

def(Boolean error, Object data, String errorMessage) = Fx.AI.invoiceValidation(invoice)
if (error) {
     log.info(errorMessage)
} else {
     log.info("success!")
}
(1).参考InvoiceData

3. 获取ocr支持的识别类型

Fx.AI.queryOcrTypes()

返回值类型

APIResult

返回值说明

List

Java举例

APIResult ret = Fx.AI.queryOcrTypes();
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

4. ocr识别

Fx.AI.ocrImages(<String ocrType>, <List paths>)

参数说明

参数 类型 说明
ocrType String ocr类型,BankCard: "银行卡识别", IdCard: "身份证识别", Invoice: "通用机打发票识别", Accurate: "通用识别类型(高精度)", Passport: "护照识别", VatInvoice: "增值税发票识别", TrainTicket: "火车票票据", TaxiReceipt: "出租车票据识别", HouseHoldRegister: "户口本识别"
paths List 图片nPath列表

返回值类型

APIResult

返回值说明

Map,识别结果

Java举例

APIResult ret = Fx.AI.ocrImages("Accurate", Lists.newArrayList("N_202107_29_96131698ed29473bb1d7baac7909eac1.jpg"));
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

参考类 com.fxiaoke.functions.model.InvoiceData

字段说明

参数 类型 说明
code String 发票代码
number String 发票号码
type String 发票类型
checkCode String 发票校验码(后6位),非必填
date String 发票日期:
amount String 发票金额(不含税)

results matching ""

    No results matching ""