Help us shape the future of Go! Take the 2026 Go Developer Survey

txai

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2018 License: MIT Imports: 13 Imported by: 1

README

腾讯AI SDK

腾讯AI开发平台sdk

腾讯AI接口调用比较简单,可以通过此库简化调用流程,返回值是结构体方便使用。 开发者可以不去考虑签名、数据请求就像调本地函数一样调用接口

示例

package main

import (
	"encoding/json"
	"log"

	"github.com/shiguanghuxian/txai" // 引入sdk
)

func main() {
	// 系统日志显示文件和行号
	log.SetFlags(log.Lshortfile | log.LstdFlags)
	// 创建sdk操作对象
	txAi := txai.New("appid", "appkey", true)
	// 调用对应腾讯ai接口的对应函数
	val, err := txAi.ImageFoodForPath("../../img/image_terrorism.jpg")
	// 打印结果
	log.Println(err)
	js, _ := json.Marshal(val)
	log.Println(string(js))
}

备注

由于腾讯AI部分接口使用gbk格式,本sdk已自动将格式转换,使用时无需考虑编码问题。

Documentation

Index

Constants

View Source
const (
	// BaseURL 腾讯ai接口根地址
	BaseURL = "https://api.ai.qq.com/fcgi-bin"
)

Variables

View Source
var Errors = map[int]error{
	-2147483635: errors.New("系统繁忙,请稍后再试"),
	-1:          errors.New("请求错误"),
	9:           errors.New("qps超过限制	用户认证升级或者降低调用频率"),
	4096:        errors.New("参数非法,请检查请求参数是否符合要求"),
	12289:       errors.New("应用不存在,请检查app_id是否有效的应用标识(AppId)"),
	12801:       errors.New("素材不存在,请检查app_id对应的素材模版id"),
	12802:       errors.New("素材ID与应用ID不匹配,请检查app_id对应的素材模版id"),
	16385:       errors.New("缺少app_id参数,请检查请求中是否包含有效的app_id参数"),
	16386:       errors.New("缺少time_stamp参数,请检查请求中是否包含有效的time_stamp参数"),
	16387:       errors.New("缺少nonce_str参数,请检查请求中是否包含有效的nonce_str参数"),
	16388:       errors.New("请求签名无效,请检查请求中的签名信息(sign)是否有效"),
	16389:       errors.New("缺失API权限,请检查应用是否勾选当前API所属接口的权限"),
	16390:       errors.New("time_stamp参数无效,请检查time_stamp距离当前时间是否超过5分钟"),
	16391:       errors.New("同义词识别结果为空,系统识别结果为空"),
	16392:       errors.New("专有名词识别结果为空,系统识别结果为空"),
	16393:       errors.New("意图识别结果为空,系统识别结果为空"),
	16394:       errors.New("闲聊返回结果为空,系统处理结果为空"),
	16396:       errors.New("图片格式非法,请检查图片格式是否符合API要求"),
	16397:       errors.New("图片体积过大,请检查图片大小是否超过API限制"),
	16402:       errors.New("图片没有人脸,请检查图片是否包含人脸"),
	16403:       errors.New("相似度错误,请联系客服反馈问题"),
	16404:       errors.New("人脸检测失败,请联系客服反馈问题"),
	16405:       errors.New("图片解码失败,请联系客服反馈问题"),
	16406:       errors.New("特征处理失败,请联系客服反馈问题"),
	16407:       errors.New("提取轮廓错误,请联系客服反馈问题"),
	16408:       errors.New("提取性别错误,请联系客服反馈问题"),
	16409:       errors.New("提取表情错误,请联系客服反馈问题"),
	16410:       errors.New("提取年龄错误,请联系客服反馈问题"),
	16411:       errors.New("提取姿态错误,请联系客服反馈问题"),
	16412:       errors.New("提取眼镜错误,请联系客服反馈问题"),
	16413:       errors.New("提取魅力值错误,请联系客服反馈问题"),
	16414:       errors.New("语音合成失败,请联系客服反馈问题"),
	16415:       errors.New("图片为空,请检查图片是否正常"),
	16416:       errors.New("个体已存在,请检查个体是否已存在"),
	16417:       errors.New("个体不存在,请检查个体是否不存在"),
	16418:       errors.New("人脸不存在,请检查人脸是否不存在"),
	16419:       errors.New("分组不存在,请检查分组是否不存在"),
	16420:       errors.New("分组列表不存在,请检查分组列表是否不存在"),
	16421:       errors.New("人脸个数超过限制,请检查是否超过系统限制"),
	16422:       errors.New("个体个数超过限制,请检查是否超过系统限制"),
	16423:       errors.New("组个数超过限制,请检查是否超过系统限制"),
	16424:       errors.New("对个体添加了几乎相同的人脸,请检查个体已添加的人脸"),
	16425:       errors.New("无效的图片格式,请检查图片格式是否符号API要求"),
	16426:       errors.New("图片模糊度检测失败,请联系客服反馈问题"),
	16427:       errors.New("美食图片检测失败,请联系客服反馈问题"),
	16428:       errors.New("提取图像指纹失败,请联系客服反馈问题"),
	16429:       errors.New("图像特征比对失败,请联系客服反馈问题"),
	16430:       errors.New("OCR照片为空,请检查待处理图片是否为空"),
	16431:       errors.New("OCR识别失败,请联系客服反馈问题"),
	16432:       errors.New("输入图片不是身份证,请检查图片是否为身份证"),
	16433:       errors.New("名片无足够文本,请检查名片是否正常"),
	16434:       errors.New("名片文本行倾斜角度太大,请检查名片是否正常"),
	16435:       errors.New("名片模糊,请检查名片是否正常"),
	16436:       errors.New("名片姓名识别失败,请联系客服反馈问题"),
	16437:       errors.New("名片电话识别失败,请联系客服反馈问题"),
	16438:       errors.New("图像为非名片图像,请检查图片是否为名片"),
	16439:       errors.New("检测或者识别失败,请联系客服反馈问题"),
	16440:       errors.New("未检测到身份证,请对准边框(避免拍摄时倾角和旋转角过大、摄像头)"),
	16441:       errors.New("请使用第二代身份证件进行扫描,请使用第二代身份证进行处理"),
	16442:       errors.New("不是身份证正面照片,请使用带证件照的一面进行处理"),
	16443:       errors.New("不是身份证反面照片,请使用身份证反面进行进行处理"),
	16444:       errors.New("证件图片模糊,请确保证件图片清晰"),
	16445:       errors.New("请避开灯光直射在证件表面,请避开灯光直射在证件表面"),
	16446:       errors.New("行驾驶证OCR识别失败,请联系客服反馈问题"),
	16447:       errors.New("通用OCR识别失败,请联系客服反馈问题"),
	16448:       errors.New("银行卡OCR预处理错误,请联系客服反馈问题"),
	16449:       errors.New("银行卡OCR识别失败,请联系客服反馈问题"),
	16450:       errors.New("营业执照OCR预处理失败,请联系客服反馈问题"),
	16451:       errors.New("营业执照OCR识别失败,请联系客服反馈问题"),
	16452:       errors.New("意图识别超时,请联系客服反馈问题"),
	16453:       errors.New("闲聊处理超时,请联系客服反馈问题"),
	16454:       errors.New("语音识别解码失败,请检查语音参数是否正确编码"),
	16455:       errors.New("语音过长或空,请检查语音参数是否正确编码或者长度是否合法"),
	16456:       errors.New("翻译引擎失败,请联系客服反馈问题"),
	16457:       errors.New("不支持的翻译类型,请检查翻译类型参数是否合法"),
	16460:       errors.New("输入图片与识别场景不匹配,请检查场景参数是否正确,所传图片与场景是否匹配"),
	16461:       errors.New("识别结果为空,当前图片无法匹配已收录的标签,请尝试更换图片"),
	16462:       errors.New("多人脸检测识别结果为空	图片中识别不出人脸,请尝试更换图片"),
	16467:       errors.New("跨年龄人脸识别出错	请尝试更换有人脸的图片"),
	16468:       errors.New("跨年龄人脸识别结果为空	源图片与目标图片中识别不出匹配的人脸,请尝试更换图片"),
	16472:       errors.New("音频鉴黄识别出错	请确保音频地址能正常下载音频,尝试更换音频"),
}
View Source
var NlpWordcomComTypeNames = map[int]string{
	0:   "未知",
	1:   "歌词",
	2:   "下载地址",
	3:   "乐器",
	4:   "歌曲",
	5:   "人名",
	6:   "时间",
	7:   "地点",
	8:   "风格",
	9:   "数字",
	10:  "视频",
	11:  "民族",
	12:  "专辑",
	13:  "序数词",
	14:  "综艺",
	15:  "乐队",
	16:  "景点",
	17:  "电影",
	18:  "电视剧",
	19:  "百科",
	34:  "股票名称",
	35:  "股票代码",
	36:  "指数",
	37:  "价格",
	38:  "行情",
	40:  "山",
	41:  "湖",
	42:  "是否",
	43:  "餐馆",
	44:  "菜名",
	45:  "儿歌",
	46:  "故事",
	47:  "相声",
	48:  "评书",
	49:  "有声内容",
	128: "类别词",
	129: "关系词",
	130: "省略词",
}

NlpWordcomComTypeNames 成分编码-名列表

View Source
var NlpWordcomIntentNames = map[int]string{
	0: "未知",
	1: "天气",
	2: "音乐",
	3: "股票",
	4: "新闻",
}

NlpWordcomIntentNames 意图编码-名列表

View Source
var NlpWordnerNames = map[int]string{
	1000: "人名",
	1100: "地名",
	1200: "机构名",
	1300: "时间",
}
View Source
var NlpWordposNames = map[int]string{
	0:  "未知词性",
	1:  "形容词",
	2:  "副形词",
	3:  "名形词",
	4:  "区别词",
	5:  "连词",
	6:  "副词",
	7:  "叹词",
	8:  "方位词",
	9:  "语素词",
	10: "前接成分",
	11: "成语",
	12: "简称略语",
	13: "后接成分",
	14: "习用语",
	15: "数词",
	16: "名词",
	17: "人名",
	18: "姓",
	19: "名",
	20: "地名",
	21: "机构团体",
	22: "其他专名",
	23: "非汉字串",
	24: "拟声词",
	25: "介词",
	26: "量词",
	27: "代词",
	28: "处所词",
	29: "时间词",
	30: "助词",
	31: "动词",
	32: "副动词",
	33: "名动词",
	34: "标点符号",
	35: "非语素字",
	36: "语气词",
	37: "状态词",
	38: "形语素",
	39: "区别语素",
	40: "副语素",
	41: "数词性语素",
	42: "名语素",
	43: "量语素",
	44: "代语素",
	45: "时语素",
	46: "动语素",
	47: "语气词语素",
	48: "状态词语素",
	49: "开始词",
	50: "URL",
	51: "电话号码",
	52: "email",
	55: "结束词",
}

NlpWordposNames 词性编码定义

View Source
var VisionObjectrNames = map[int]string{}/* 1000 elements not displayed */
View Source
var VisionScenerNames = map[int]string{}/* 299 elements not displayed */

Functions

func AaiDetectkeywordHandleCallback

func AaiDetectkeywordHandleCallback(body []byte) (*AaiDetectkeywordResponse, *BaseResponse, error)

AaiDetectkeywordHandleCallback 处理回调数据

func AaiWxasrlongHandleCallback

func AaiWxasrlongHandleCallback(body []byte) (*AaiWxasrlongResponse, *BaseResponse, error)

AaiWxasrlongHandleCallback 处理回调数据

func GetError

func GetError(ret int) error

GetError 根据错代码获取错误

Types

type AaiAsrResponse

type AaiAsrResponse struct {
	BaseResponse
	Data struct {
		Format AaiAudioType `json:"format"`
		Rate   int          `json:"rate"`
		Text   string       `json:"text"`
	} `json:"data"`
}

AaiAsrResponse 语音识别-echo版

type AaiAsrsResponse

type AaiAsrsResponse struct {
	BaseResponse
	Data struct {
		Format     int    `json:"format"`
		Rate       int    `json:"rate"`
		Seq        int    `json:"seq"`
		Len        int    `json:"len"`
		End        int    `json:"end"`
		SpeechID   string `json:"speech_id"`
		SpeechText string `json:"speech_text"`
	} `json:"data"`
}

AaiAsrsResponse 语音识别-流式版(AI Lab)

type AaiAudioType

type AaiAudioType = int

AaiAudioType 语言识别 语音压缩格式编码

const (
	AaiAudioPCM   AaiAudioType = 1
	AaiAudioWAV   AaiAudioType = 2
	AaiAudioAMR   AaiAudioType = 3
	AaiAudioSILK  AaiAudioType = 4
	AaiAudioSPEEX AaiAudioType = 5
	AaiAudioMP3   AaiAudioType = 8
)

type AaiDetectkeywordResponse

type AaiDetectkeywordResponse struct {
	BaseResponse
	Data struct {
		Bps   int `json:"bps"`
		Eps   int `json:"eps"`
		IsEnd int `json:"is_end"`
		Res   struct {
			KeyWords []struct {
				KeyWord string  `json:"key_word"`
				Mbtm    int     `json:"mbtm"`
				Metm    float64 `json:"metm"`
				Score   int     `json:"score"`
			} `json:"key_words"`
			KeyWordsSize int `json:"key_words_size"`
		} `json:"res"`
		SegIndex int    `json:"seg_index"`
		TaskID   string `json:"task_id"`
	} `json:"data"`
}

AaiDetectkeywordResponse 关键词检索

type AaiEvilaudioResponse added in v1.0.2

type AaiEvilaudioResponse struct {
	BaseResponse
	Data struct {
		SpeechID  string `json:"speech_id"`
		SpeechURL string `json:"speech_url"`
		PornFlag  int    `json:"porn_flag"`
		PornScore int    `json:"porn_score"`
	} `json:"data"`
}

AaiEvilaudioResponse 音频鉴黄

type AaiTtaModelType

type AaiTtaModelType = int

AaiTtaModelType 语音合成(优图) 模型编码

const (
	// AaiTtaModelType0 女生
	AaiTtaModelType0 AaiTtaModelType = 0
	// AaiTtaModelType1 女生纯英文
	AaiTtaModelType1 AaiTtaModelType = 1
	// AaiTtaModelType2 男生
	AaiTtaModelType2 AaiTtaModelType = 2
	// AaiTtaModelType6 喜道公子
	AaiTtaModelType6 AaiTtaModelType = 6
)

type AaiTtaResponse

type AaiTtaResponse struct {
	BaseResponse
	Data struct {
		Voice []byte `json:"voice"`
	} `json:"data"`
}

AaiTtaResponse 语音合成(优图)

type AaiTtsFormatType

type AaiTtsFormatType = int

AaiTtsFormatType 语音合成(AI Lab) 合成语音格式编码

const (
	// AaiTtsFormatPCM PCM
	AaiTtsFormatPCM AaiTtsFormatType = 1
	// AaiTtsFormatWAV WAV
	AaiTtsFormatWAV AaiTtsFormatType = 2
	// AaiTtsFormatMP3 MP3
	AaiTtsFormatMP3 AaiTtsFormatType = 3
)

type AaiTtsResponse

type AaiTtsResponse struct {
	BaseResponse
	Data struct {
		Format int    `json:"format"`
		Speech []byte `json:"speech"`
		Md5Sum string `json:"md5sum"`
	} `json:"data"`
}

AaiTtsResponse 语音合成(AI Lab)

type AaiTtsSpeakerType

type AaiTtsSpeakerType = int

AaiTtsSpeakerType 语音合成(AI Lab) 语音发音人编码

const (
	// AaiTtsSpeaker1 普通话男声
	AaiTtsSpeaker1 AaiTtsSpeakerType = 1
	// AaiTtsSpeaker5 静琪女声
	AaiTtsSpeaker5 AaiTtsSpeakerType = 5
	// AaiTtsSpeaker6 欢馨女声
	AaiTtsSpeaker6 AaiTtsSpeakerType = 6
	// AaiTtsSpeaker7 碧萱女声
	AaiTtsSpeaker7 AaiTtsSpeakerType = 7
)

type AaiWxasrlongResponse

type AaiWxasrlongResponse struct {
	BaseResponse
	Data struct {
		TaskID string `json:"task_id"`
		Text   string `json:"text"`
	} `json:"data"`
}

AaiWxasrlongResponse 长语音识别

type AaiWxasrsResponse

type AaiWxasrsResponse struct {
	BaseResponse
	Data struct {
		Format     int    `json:"format"`
		Rate       int    `json:"rate"`
		End        int    `json:"end"`
		SpeechID   string `json:"speech_id"`
		SpeechText string `json:"speech_text"`
		IsFinalRes int    `json:"is_final_res"`
		Ack        int    `json:"ack"`
	} `json:"data"`
}

AaiWxasrsResponse 语音识别-流式版(AI Lab)

type BaseResponse

type BaseResponse struct {
	Ret int    `json:"ret"`
	Msg string `json:"msg"`
}

BaseResponse 基本响应结构

func (*BaseResponse) GetRet

func (resp *BaseResponse) GetRet() int

GetRet 获取状态码

type BaseResponseInterface

type BaseResponseInterface interface {
	GetRet() int
}

BaseResponseInterface 基础模型接口,用于统一请求使用

type FaceAddfaceResponse

type FaceAddfaceResponse struct {
	BaseResponse
	Data struct {
		Added    int      `json:"added"`
		FaceIds  []string `json:"face_ids"`
		RetCodes []int    `json:"ret_codes"`
	} `json:"data"`
}

FaceAddfaceResponse 增加人脸

type FaceDelfaceResponse

type FaceDelfaceResponse struct {
	BaseResponse
	Data struct {
		Deleted int      `json:"deleted"`
		FaceIds []string `json:"face_ids"`
	} `json:"data"`
}

FaceDelfaceResponse 删除人脸

type FaceDelpersonResponse

type FaceDelpersonResponse struct {
	BaseResponse
	Data struct {
		Deleted  int    `json:"deleted"`
		PersonID string `json:"person_id"`
	} `json:"data"`
}

FaceDelpersonResponse 删除个体

type FaceDetectcrossagefaceResponse

type FaceDetectcrossagefaceResponse struct {
	BaseResponse
	Data struct {
		SourceFace struct {
			X1 float64 `json:"x1"`
			Y1 float64 `json:"y1"`
			X2 float64 `json:"x2"`
			Y2 float64 `json:"y2"`
		} `json:"source_face"`
		TargetFace struct {
			X1 float64 `json:"x1"`
			Y1 float64 `json:"y1"`
			X2 float64 `json:"x2"`
			Y2 float64 `json:"y2"`
		} `json:"target_face"`
		Score    float64 `json:"score"`
		FailFlag int     `json:"fail_flag"`
	} `json:"data"`
}

FaceDetectcrossagefaceResponse 跨年龄人脸识别

type FaceDetectfaceResponse

type FaceDetectfaceResponse struct {
	BaseResponse
	Data struct {
		ImageWidth  int `json:"image_width"`
		ImageHeight int `json:"image_height"`
		FaceList    []struct {
			FaceID     string `json:"face_id"`
			X          int    `json:"x"`
			Y          int    `json:"y"`
			Width      int    `json:"width"`
			Height     int    `json:"height"`
			Gender     int    `json:"gender"`
			Age        int    `json:"age"`
			Expression int    `json:"expression"`
			Beauty     int    `json:"beauty"`
			Glass      int    `json:"glass"`
			Pitch      int    `json:"pitch"`
			Yaw        int64  `json:"yaw"`
			Roll       int    `json:"roll"`
			FaceShape  struct {
				FaceProfile []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"face_profile"`
				LeftEye []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"left_eye"`
				RightEye []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"right_eye"`
				LeftEyebrow []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"left_eyebrow"`
				RightEyebrow []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"right_eyebrow"`
				Mouth []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"mouth"`
				Nose []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"nose"`
			} `json:"face_shape"`
		} `json:"face_list"`
	} `json:"data"`
}

FaceDetectfaceResponse 人脸检测与分析

type FaceDetectmultifaceResponse

type FaceDetectmultifaceResponse struct {
	BaseResponse
	Data struct {
		FaceList []struct {
			X1 float64 `json:"x1"`
			Y1 float64 `json:"y1"`
			X2 float64 `json:"x2"`
			Y2 float64 `json:"y2"`
		} `json:"face_list"`
	} `json:"data"`
}

FaceDetectmultifaceResponse 多人脸检测

type FaceFacecompareResponse

type FaceFacecompareResponse struct {
	BaseResponse
	Data struct {
		Similarity int `json:"similarity"`
		FailFlag   int `json:"fail_flag"`
	} `json:"data"`
}

FaceFacecompareResponse 人脸对比

type FaceFaceidentifyResponse

type FaceFaceidentifyResponse struct {
	BaseResponse
	Data struct {
		TimeMs     int `json:"time_ms"`
		GroupSize  int `json:"group_size"`
		Candidates []struct {
			PersonID   string `json:"person_id"`
			FaceID     string `json:"face_id"`
			Confidence int    `json:"confidence"`
			Tag        string `json:"tag"`
		} `json:"candidates"`
	} `json:"data"`
}

FaceFaceidentifyResponse 人脸识别

type FaceFaceshapeResponse

type FaceFaceshapeResponse struct {
	BaseResponse
	Data struct {
		ImageWidth  int `json:"image_width"`
		ImageHeight int `json:"image_height"`
		FaceList    []struct {
			FaceID     string `json:"face_id"`
			X          int    `json:"x"`
			Y          int    `json:"y"`
			Width      int    `json:"width"`
			Height     int    `json:"height"`
			Gender     int    `json:"gender"`
			Age        int    `json:"age"`
			Expression int    `json:"expression"`
			Beauty     int    `json:"beauty"`
			Glass      int    `json:"glass"`
			Pitch      int    `json:"pitch"`
			Yaw        int    `json:"yaw"`
			Roll       int    `json:"roll"`
			FaceShape  struct {
				FaceProfile []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"face_profile"`
				LeftEye []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"left_eye"`
				RightEye []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"right_eye"`
				LeftEyebrow []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"left_eyebrow"`
				RightEyebrow []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"right_eyebrow"`
				Mouth []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"mouth"`
				Nose []struct {
					X int `json:"x"`
					Y int `json:"y"`
				} `json:"nose"`
			} `json:"face_shape"`
		} `json:"face_list"`
	} `json:"data"`
}

FaceFaceshapeResponse 五官定位

type FaceFaceverifyResponse

type FaceFaceverifyResponse struct {
	BaseResponse
	Data struct {
		Ismatch    int `json:"ismatch"`
		Confidence int `json:"confidence"`
	} `json:"data"`
}

FaceFaceverifyResponse 人脸验证

type FaceGetfaceidsResponse

type FaceGetfaceidsResponse struct {
	BaseResponse
	Data struct {
		FaceIds []string `json:"face_ids"`
	} `json:"data"`
}

FaceGetfaceidsResponse 获取人脸列表 - 根据个体(Person)ID 获取人脸(Face)ID列表

type FaceGetfaceinfoResponse

type FaceGetfaceinfoResponse struct {
	BaseResponse
	Data struct {
		FaceInfo struct {
			FaceID     string `json:"face_id"`
			X          int    `json:"x"`
			Y          int    `json:"y"`
			Width      int    `json:"width"`
			Height     int    `json:"height"`
			Gender     int    `json:"gender"`
			Age        int    `json:"age"`
			Expression int    `json:"expression"`
			Beauty     int    `json:"beauty"`
			Glass      int    `json:"glass"`
			Pitch      int    `json:"pitch"`
			Yaw        int64  `json:"yaw"`
			Roll       int64  `json:"roll"`
		} `json:"face_info"`
	} `json:"data"`
}

FaceGetfaceinfoResponse 获取人脸信息 - 根据人脸(Face)ID 获取人脸(Face)信息

type FaceGetgroupidsResponse

type FaceGetgroupidsResponse struct {
	BaseResponse
	Data struct {
		GroupIds []string `json:"group_ids"`
	} `json:"data"`
}

FaceGetgroupidsResponse 获取组列表

type FaceGetinfoResponse

type FaceGetinfoResponse struct {
	BaseResponse
	Data struct {
		PersonID   string   `json:"person_id"`
		PersonName string   `json:"person_name"`
		Tag        string   `json:"tag"`
		FaceIds    []string `json:"face_ids"`
		GroupIds   []string `json:"group_ids"`
	} `json:"data"`
}

FaceGetinfoResponse 获取信息

type FaceGetpersonidsResponse

type FaceGetpersonidsResponse struct {
	BaseResponse
	Data struct {
		PersonIds []string `json:"person_ids"`
	} `json:"data"`
}

FaceGetpersonidsResponse 获取个体列表

type FaceNewpersonResponse

type FaceNewpersonResponse struct {
	BaseResponse
	Data struct {
		SucGroup int      `json:"suc_group"`
		SucFace  int      `json:"suc_face"`
		PersonID string   `json:"person_id"`
		FaceID   string   `json:"face_id"`
		GroupIds []string `json:"group_ids"`
	} `json:"data"`
}

FaceNewpersonResponse 个体创建

type FaceSetinfoResponse

type FaceSetinfoResponse struct {
	BaseResponse
	Data struct {
		PersonID string `json:"person_id"`
	} `json:"data"`
}

FaceSetinfoResponse 设置信息

type FormatAudioType

type FormatAudioType int

FormatAudioType 语音翻译 语音压缩格式编码类型

const (
	AudioAMR  FormatAudioType = 3
	AudioSILK FormatAudioType = 4
	AudioPCM  FormatAudioType = 6
	AudioMP3  FormatAudioType = 8
	AudioAAC  FormatAudioType = 9
)

type ImageFoodResponse

type ImageFoodResponse struct {
	BaseResponse
	Data struct {
		Food       bool    `json:"food"`
		Confidence float64 `json:"confidence"`
	} `json:"data"`
}

ImageFoodResponse 美食图片识别

type ImageFuzzyResponse

type ImageFuzzyResponse struct {
	BaseResponse
	Data struct {
		Fuzzy      bool    `json:"fuzzy"`
		Confidence float64 `json:"confidence"`
	} `json:"data"`
}

ImageFuzzyResponse 模糊图片检测

type ImageTagResponse

type ImageTagResponse struct {
	BaseResponse
	Data struct {
		TagList []struct {
			TagConfidence int    `json:"tag_confidence"`
			TagName       string `json:"tag_name"`
		} `json:"tag_list"`
	} `json:"data"`
}

ImageTagResponse 图像标签识别

type ImageTerrorismResponse

type ImageTerrorismResponse struct {
	BaseResponse
	Terrorists int // 恐怖分子
	Knife      int // 刀
	Guns       int // 枪支
	Blood      int // 血液
	Fire       int // 火
	Flag       int // 旗帜
	Crowd      int // 人群
	Other      int // 其他
	Data       struct {
		TagList []struct {
			TagConfidence  int     `json:"tag_confidence"`
			TagConfidenceF float64 `json:"tag_confidence_f"`
			TagName        string  `json:"tag_name"`
		} `json:"tag_list"`
	} `json:"data"`
}

ImageTerrorismResponse 暴恐图片识别

type ItemList

type ItemList struct {
	Item       string `json:"item"`
	Itemstring string `json:"itemstring"`
	Itemcoord  []struct {
		X      int `json:"x"`
		Y      int `json:"y"`
		Width  int `json:"width"`
		Height int `json:"height"`
	} `json:"itemcoord"`
	Itemconf float64 `json:"itemconf,omitempty"`
	Words    []struct {
		Character  string  `json:"character"`
		Confidence float64 `json:"confidence"`
	} `json:"words,omitempty"`
}

ItemList OCR 通用ItemList

type Lang

type Lang = string

Lang 语言

const (
	// Zh 中文
	Zh Lang = "zh"
	// En 英文
	En Lang = "en"
	// Jp 日文
	Jp Lang = "jp"
	// Kr 韩文
	Kr Lang = "kr"
	// Fr 法文
	Fr Lang = "fr"
	// Es 西班牙文
	Es Lang = "es"
	// It 意大利文
	It Lang = "it"
	// De 德文
	De Lang = "de"
	// Tr 土耳其文
	Tr Lang = "tr"
	// Ru 俄文
	Ru Lang = "ru"
	// Pt 葡萄牙文
	Pt Lang = "pt"
	// Vi 越南文
	Vi Lang = "vi"
	// Id 印度尼西亚文
	Id Lang = "id"
	// Ms 马来西亚文
	Ms Lang = "ms"
	// Th 泰文
	Th Lang = "th"
	// LangAuto 自动识别(中英互译)
	Auto Lang = "auto"
)

type LangType

type LangType uint

LangType 翻译类型

const (
	// LangAuto 自动识别(中英文互转)
	LangAuto LangType = 0
	// LangZhToEn 中文翻译成英文
	LangZhToEn LangType = 1
	// LangEnToZh 英文翻译成中文
	LangEnToZh LangType = 1
	// LangZhToEs 中文翻译成西班牙文
	LangZhToEs LangType = 3
	// LangEsToZh 西班牙文翻译成中文
	LangEsToZh LangType = 4
	// LangZhToFr 中文翻译成法文
	LangZhToFr LangType = 5
	// LangFrToZh 法文翻译成中文
	LangFrToZh LangType = 6
	// LangZhToVi 英文翻译成越南语
	LangZhToVi LangType = 7
	// LangViToZh 越南语翻译成英文
	LangViToZh LangType = 8
	// LangZhToZhYY 中文翻译成粤语
	LangZhToZhYY LangType = 9
	// LangZhYYToZh 中文翻译成粤语
	LangZhYYToZh LangType = 10
	// LangZhToKr 中文翻译成韩文
	LangZhToKr LangType = 11
	// LangEnToDe 英文翻译成德语
	LangEnToDe LangType = 13
	// LangDeToEn 德语翻译成英文
	LangDeToEn LangType = 14
	// LangZhToJp 中文翻译成日文
	LangZhToJp LangType = 15
	// LangJpToZh 日文翻译成中文
	LangJpToZh LangType = 16
)

type NlpImagetranslateResponse

type NlpImagetranslateResponse struct {
	BaseResponse
	Data struct {
		SessionID    string `json:"session_id"`
		ImageRecords []struct {
			SourceText string `json:"source_text"`
			TargetText string `json:"target_text"`
			X          int    `json:"x"`
			Y          int    `json:"y"`
			Width      int    `json:"width"`
			Height     int    `json:"height"`
		} `json:"image_records"`
	} `json:"data"`
}

NlpImagetranslateResponse 图片翻译

type NlpSpeechtranslateResponse

type NlpSpeechtranslateResponse struct {
	BaseResponse
	Data struct {
		SessionID  string `json:"session_id"`
		End        int    `json:"end"`
		Seq        int    `json:"seq"`
		SourceText string `json:"source_text"`
		TargetText string `json:"target_text"`
	} `json:"data"`
}

NlpSpeechtranslateResponse 语音翻译

type NlpTextchatResponse

type NlpTextchatResponse struct {
	BaseResponse
	Data struct {
		Session string `json:"session"`
		Answer  string `json:"answer"`
	} `json:"data"`
}

NlpTextchatResponse 智能闲聊

type NlpTextdetectResponse

type NlpTextdetectResponse struct {
	BaseResponse
	Data struct {
		Lang Lang `json:"lang"`
	} `json:"data"`
}

NlpTextdetectResponse 语种识别

type NlpTextpolarResponse

type NlpTextpolarResponse struct {
	BaseResponse
	Data struct {
		Text      string  `json:"text"`
		Polar     int     `json:"polar"`
		PolarName string  `json:"polar_name"`
		Confd     float64 `json:"confd"`
	} `json:"data"`
}

NlpTextpolarResponse 情感分析

type NlpTexttransResponse

type NlpTexttransResponse struct {
	BaseResponse
	Data struct {
		Type      LangType `json:"type"`
		OrgText   string   `json:"org_text"`
		TransText string   `json:"trans_text"`
	} `json:"data"`
}

NlpTexttransResponse 文本翻译(AI Lab)

type NlpTexttranslateResponse

type NlpTexttranslateResponse struct {
	BaseResponse
	Data struct {
		SourceText string `json:"source_text"`
		TargetText string `json:"target_text"`
	} `json:"data"`
}

NlpTexttranslateResponse 文本翻译(翻译君)

type NlpWordcomResponse

type NlpWordcomResponse struct {
	BaseResponse
	Data struct {
		Text       string `json:"text"`
		Intent     int    `json:"intent"`
		IntentName string `json:"intent_name"`
		ComTokens  []*struct {
			ComType     int    `json:"com_type"`
			ComTypeName string `json:"com_type_name"`
			ComWord     string `json:"com_word"`
		} `json:"com_tokens"`
	} `json:"data"`
}

NlpWordcomResponse 语义解析

type NlpWordnerResponse

type NlpWordnerResponse struct {
	BaseResponse
	Data struct {
		Text      string `json:"text"`
		NerTokens []*struct {
			Word      string   `json:"word"`
			Offset    int      `json:"offset"`
			Length    int      `json:"length"`
			Types     []int    `json:"types"`
			Weights   []int    `json:"weights"`
			TypeNames []string `json:"type_names"`
		} `json:"ner_tokens"`
	} `json:"data"`
}

NlpWordnerResponse 专有名词识别接口

type NlpWordposResponse

type NlpWordposResponse struct {
	BaseResponse
	Data struct {
		Text       string `json:"text"`
		BaseTokens []*struct {
			Word        string `json:"word"`
			Offset      int    `json:"offset"`
			Length      int    `json:"length"`
			PosCode     int    `json:"pos_code"`
			PosCodeName string `json:"pos_code_name"`
		} `json:"base_tokens"`
		MixTokens []*struct {
			Word        string `json:"word"`
			Offset      int    `json:"offset"`
			Length      int    `json:"length"`
			PosCode     int    `json:"pos_code"`
			PosCodeName string `json:"pos_code_name"`
		} `json:"mix_tokens"`
	} `json:"data"`
}

NlpWordposResponse 词性标注

type NlpWordsegResponse

type NlpWordsegResponse struct {
	BaseResponse
	Data struct {
		Text       string `json:"text"`
		BaseTokens []struct {
			Word   string `json:"word"`
			Offset int    `json:"offset"`
			Length int    `json:"length"`
		} `json:"base_tokens"`
		MixTokens []struct {
			Word   string `json:"word"`
			Offset int    `json:"offset"`
			Length int    `json:"length"`
		} `json:"mix_tokens"`
	} `json:"data"`
}

NlpWordsegResponse 分词

type NlpWordsynResponse

type NlpWordsynResponse struct {
	BaseResponse
	Data struct {
		Text      string `json:"text"`
		SynTokens []struct {
			OriWord struct {
				Word   string `json:"word"`
				Offset int    `json:"offset"`
				Length int    `json:"length"`
			} `json:"ori_word"`
			SynWords []struct {
				Word   string  `json:"word"`
				Weight float64 `json:"weight"`
			} `json:"syn_words"`
		} `json:"syn_tokens"`
	} `json:"data"`
}

NlpWordsynResponse 同义词识别

type OcrIDCardResponse

type OcrIDCardResponse struct {
	BaseResponse
	Data struct {
		Name       string `json:"name"`
		Sex        string `json:"sex"`
		Nation     string `json:"nation"`
		Birth      string `json:"birth"`
		Address    string `json:"address"`
		Id         string `json:"id"`
		Frontimage string `json:"frontimage"`
		Authority  string `json:"authority"`
		ValidDate  string `json:"valid_date"`
		Backimage  string `json:"backimage"`
	} `json:"data"`
}

OcrIDCardResponse 身份证识别

type OcrResponse

type OcrResponse struct {
	BaseResponse
	Data struct {
		Angle    string     `json:"angle"`
		ItemList []ItemList `json:"item_list"`
	} `json:"data"`
}

OcrResponse OCR 通用响应结构

type PtuResponse

type PtuResponse struct {
	BaseResponse
	Data struct {
		Image []byte `json:"image"`
	} `json:"data"`
}

PtuResponse 图片特效统一响应格式

type SceneType

type SceneType = string

SceneType 图片翻译识别类型

const (
	// SceneWord 单词识别
	SceneWord SceneType = "word"
	// SceneDoc 文档识别
	SceneDoc SceneType = "doc"
)

type TxAi

type TxAi struct {
	AppID  string // AppID 从腾讯AI控制台获取
	AppKey string // AppKey 从腾讯AI控制台获取
	// contains filtered or unexported fields
}

TxAi 腾讯ai sqk

func New

func New(appID, appKey string, debug bool) *TxAi

New 创建一个sdk操作对象 := gorequest.New()

func (*TxAi) AaiAsrForBase64

func (ai *TxAi) AaiAsrForBase64(speech string, format AaiAudioType, rate ...int) (*AaiAsrResponse, error)

AaiAsrForBase64 语音识别-echo版 - 音频为base64格式 speech 待识别语音(时长上限15s) format 语音压缩格式编码,定义见下文描述 rate 语音采样率编码,定义见下文描述,(不传)默认即16KHz

func (*TxAi) AaiAsrForPath

func (ai *TxAi) AaiAsrForPath(speechPath string, format AaiAudioType, rate ...int) (*AaiAsrResponse, error)

AaiAsrForPath 语音识别-echo版 - 音频为本地路径 imagePath 本地图片路径 speech 本地语音路径(时长上限15s) format 语音压缩格式编码,定义见下文描述 rate 语音采样率编码,定义见下文描述,(不传)默认即16KHz

func (*TxAi) AaiAsrsForBase64

func (ai *TxAi) AaiAsrsForBase64(speechChunk string, format AaiAudioType, seq, length, end int, speechId string, rate ...int) (*AaiAsrsResponse, error)

AaiAsrsForBase64 语音识别-流式版(AI Lab) - 音频为base64格式 speechChunk 待识别语音分片 format 音频压缩格式编码,定义见 https://ai.qq.com/doc/aaiasr.shtml seq 语音分片所在语音流的偏移量(字节) length 语音分片长度(字节) end 是否结束分片标识,定义见 https://ai.qq.com/doc/aaiasr.shtml speechId 语音唯一标识 rate 音频采样率编码,定义见下文描述

func (*TxAi) AaiAsrsForPath

func (ai *TxAi) AaiAsrsForPath(speechChunkPath string, format AaiAudioType, seq, end int, speechId string, rate ...int) (*AaiAsrsResponse, error)

AaiAsrsForPath 语音识别-流式版(AI Lab) - 音频为本地路径 speechChunkPath 本地待识别语音分片路径 format 音频压缩格式编码,定义见 https://ai.qq.com/doc/aaiasr.shtml seq 语音分片所在语音流的偏移量(字节) end 是否结束分片标识,定义见 https://ai.qq.com/doc/aaiasr.shtml speechId 语音唯一标识 rate 音频采样率编码,定义见下文描述

func (*TxAi) AaiDetectkeywordForBase64

func (ai *TxAi) AaiDetectkeywordForBase64(speech, speechURL string, format AaiAudioType, callbackURL string, keyWords ...string) (*AaiDetectkeywordResponse, error)

AaiDetectkeywordForBase64 关键词检索 - 音频为base64格式 speech 待识别语音(时长上限15s) format 语音压缩格式编码,定义见 https://ai.qq.com/doc/detectword.shtml callbackURL 用户回调url,需用户提供,用于平台向用户通知识别结果 keyWords 待识别关键词 speechURL 待识别语音下载地址(时长上限15min)

func (*TxAi) AaiDetectkeywordForPath

func (ai *TxAi) AaiDetectkeywordForPath(speechPath, speechURL string, format AaiAudioType, callbackURL string, keyWords ...string) (*AaiDetectkeywordResponse, error)

AaiDetectkeywordForPath 关键词检索 - 音频为本地路径 speechPath 本地待识别语音路径(时长上限15s) format 语音压缩格式编码,定义见 https://ai.qq.com/doc/detectword.shtml callbackURL 用户回调url,需用户提供,用于平台向用户通知识别结果 keyWords 待识别关键词 speechURL 待识别语音下载地址(时长上限15min)

func (*TxAi) AaiEvilaudioForUrl added in v1.0.2

func (ai *TxAi) AaiEvilaudioForUrl(speechId, speechURL string) (*AaiEvilaudioResponse, error)

AaiEvilaudioForUrl 音频鉴黄

func (*TxAi) AaiTtaForText

func (ai *TxAi) AaiTtaForText(text string, modelType AaiTtaModelType, speed int) (*AaiTtaResponse, error)

AaiTtaForText 语音合成(优图) text 待合成文本 modelType 发音模型,默认为0,定义见 https://ai.qq.com/doc/aaitts.shtml speed 语速,默认为0 0.6倍速-2,0.8倍速-1,正常速度0,1.2倍速1,1.5倍速2

func (*TxAi) AaiTtsForText

func (ai *TxAi) AaiTtsForText(text string, speaker AaiTtsSpeakerType, format AaiTtsFormatType, volume, speed, aht, apc int) (*AaiTtsResponse, error)

AaiTtsForText 语音合成(AI Lab) text 待合成文本 speaker 语音发音人编码,定义见 https://ai.qq.com/doc/aaitts.shtml format 合成语音格式编码 volume 合成语音音量,取值范围[-10, 10],如-10表示音量相对默认值小10dB,0表示默认音量,10表示音量相对默认值大10dB speed 合成语音语速,默认100 aht 合成语音降低/升高半音个数,即改变音高,默认0 apc 控制频谱翘曲的程度,改变说话人的音色,默认58

func (*TxAi) AaiWxasrlongForBase64

func (ai *TxAi) AaiWxasrlongForBase64(speech string, format AaiAudioType, callbackURL, speechURL string) (*AaiWxasrlongResponse, error)

AaiWxasrlongForBase64 长语音识别 - 音频为base64格式 speech 待识别语音(时长上限15s) format 语音压缩格式编码,定义见 https://ai.qq.com/doc/wxasrlong.shtml callbackURL 用户回调url,需用户提供,用于平台向用户通知识别结果,详见下文描述 speechURL 待识别语音下载地址(时长上限15min)

func (*TxAi) AaiWxasrlongForPath

func (ai *TxAi) AaiWxasrlongForPath(speechPath string, format AaiAudioType, callbackURL, speechURL string) (*AaiWxasrlongResponse, error)

AaiWxasrlongForPath 长语音识别 - 音频为本地路径 speechPath 本地待识别语音路径(时长上限15s) format 语音压缩格式编码,定义见 https://ai.qq.com/doc/wxasrlong.shtml callbackURL 用户回调url,需用户提供,用于平台向用户通知识别结果,详见下文描述 speechURL 待识别语音下载地址(时长上限15min)

func (*TxAi) AaiWxasrsForBase64

func (ai *TxAi) AaiWxasrsForBase64(speechChunk string, format AaiAudioType, rate, bits, seq, length, end int, speechId string, contRes int) (*AaiWxasrsResponse, error)

AaiWxasrsForBase64 语音识别-流式版(AI Lab) - 音频为base64格式 speechChunk 待识别语音分片 format 音频压缩格式编码,定义见 https://ai.qq.com/doc/aaiasr.shtml rate 音频采样率编码,定义见 https://ai.qq.com/doc/aaiasr.shtml bits 音频采样位数,定义见 https://ai.qq.com/doc/aaiasr.shtml seq 语音分片所在语音流的偏移量(字节) length 语音分片长度(字节) end 是否结束分片标识,定义见下文描述 speechId 语音唯一标识 contRes 是否获取中间识别结果,定义见 https://ai.qq.com/doc/aaiasr.shtml

func (*TxAi) AaiWxasrsForPath

func (ai *TxAi) AaiWxasrsForPath(speechChunkPath string, format AaiAudioType, rate, bits, seq, end int, speechId string, contRes int) (*AaiWxasrsResponse, error)

AaiWxasrsForPath 语音识别-流式版(AI Lab) - 音频为本地路径 speechChunkPath 本地待识别语音分片路径 format 音频压缩格式编码,定义见 https://ai.qq.com/doc/aaiasr.shtml rate 音频采样率编码,定义见 https://ai.qq.com/doc/aaiasr.shtml bits 音频采样位数,定义见 https://ai.qq.com/doc/aaiasr.shtml seq 语音分片所在语音流的偏移量(字节) end 是否结束分片标识,定义见下文描述 speechId 语音唯一标识 contRes 是否获取中间识别结果,定义见 https://ai.qq.com/doc/aaiasr.shtml

func (*TxAi) FaceAddMultiplefaceForPath

func (ai *TxAi) FaceAddMultiplefaceForPath(personId, tag string, imagePaths ...string) (*FaceAddfaceResponse, error)

FaceAddMultiplefaceForPath 增加人脸 - 图片为本地路径 imagePath 本地图片路径 personId 指定的个体(Person)ID tag 备注信息

func (*TxAi) FaceAddfaceForBase64

func (ai *TxAi) FaceAddfaceForBase64(images, personId, tag string) (*FaceAddfaceResponse, error)

FaceAddfaceForBase64 增加人脸 - 图片为base64格式 image 图片base64后字符串 personId 指定的个体(Person)ID tag 备注信息

func (*TxAi) FaceAddfaceForPath

func (ai *TxAi) FaceAddfaceForPath(imagePath, personId, tag string) (*FaceAddfaceResponse, error)

FaceAddfaceForPath 增加人脸 - 图片为本地路径 imagePath 本地图片路径 personId 指定的个体(Person)ID tag 备注信息

func (*TxAi) FaceDelfaceForPersonId

func (ai *TxAi) FaceDelfaceForPersonId(personId string, faceIds ...string) (*FaceDelfaceResponse, error)

FaceDelfaceForPersonId 获取信息 personId 指定的个体(Person)ID faceIds 需要删除的人脸(Face)ID(多个之间用"|")

func (*TxAi) FaceDelpersonForPersonId

func (ai *TxAi) FaceDelpersonForPersonId(personId string) (*FaceDelpersonResponse, error)

FaceDelpersonForPersonId 删除个体 personId 需要删除的个体(Person)ID

func (*TxAi) FaceDetectcrossagefaceForBase64

func (ai *TxAi) FaceDetectcrossagefaceForBase64(sourceImage, targetImage string) (*FaceDetectcrossagefaceResponse, error)

FaceDetectcrossagefaceForBase64 跨年龄人脸识别 - 图片为base64格式 sourceImage 待比较图片 targetImage 待比较图片

func (*TxAi) FaceDetectcrossagefaceForPath

func (ai *TxAi) FaceDetectcrossagefaceForPath(sourceImagePath, targetImagePath string) (*FaceDetectcrossagefaceResponse, error)

FaceDetectcrossagefaceForPath 跨年龄人脸识别 - 图片为本地路径 sourceImage 待比较图片 targetImage 待比较图片

func (*TxAi) FaceDetectfaceForBase64

func (ai *TxAi) FaceDetectfaceForBase64(image string, modes ...int) (*FaceDetectfaceResponse, error)

FaceDetectfaceForBase64 人脸检测与分析 - 图片为base64格式 image 图片base64后字符串 modes 检测模式,0-正常,1-大脸模式(默认1)

func (*TxAi) FaceDetectfaceForPath

func (ai *TxAi) FaceDetectfaceForPath(imagePath string, modes ...int) (*FaceDetectfaceResponse, error)

FaceDetectfaceForPath 人脸检测与分析 - 图片为本地路径 imagePath 本地图片路径 modes 检测模式,0-正常,1-大脸模式(默认1)

func (*TxAi) FaceDetectmultifaceForBase64

func (ai *TxAi) FaceDetectmultifaceForBase64(image string) (*FaceDetectmultifaceResponse, error)

FaceDetectmultifaceForBase64 多人脸检测 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) FaceDetectmultifaceForPath

func (ai *TxAi) FaceDetectmultifaceForPath(imagePath string) (*FaceDetectmultifaceResponse, error)

FaceDetectmultifaceForPath 多人脸检测 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) FaceFacecompareForBase64

func (ai *TxAi) FaceFacecompareForBase64(imageA, imageB string) (*FaceFacecompareResponse, error)

FaceFacecompareForBase64 人脸对比 - 图片为base64格式 imageA 待对比人脸图片A imageB 待对比人脸图片B

func (*TxAi) FaceFacecompareForPath

func (ai *TxAi) FaceFacecompareForPath(imageAPath, imageBPath string) (*FaceFacecompareResponse, error)

FaceFacecompareForPath 人脸对比 - 图片为本地路径 imageAPath 待对比人脸图片A imageBPath 待对比人脸图片B

func (*TxAi) FaceFaceidentifyForBase64

func (ai *TxAi) FaceFaceidentifyForBase64(image string, groupId string, topns ...int) (*FaceFaceidentifyResponse, error)

FaceFaceidentifyForBase64 人脸识别 - 图片为base64格式 image 图片base64后字符串 groupId 候选人组ID(个体创建时设定) topns 返回的候选人个数(默认9个)

func (*TxAi) FaceFaceidentifyForPath

func (ai *TxAi) FaceFaceidentifyForPath(imagePath string, groupId string, topns ...int) (*FaceFaceidentifyResponse, error)

FaceFaceidentifyForPath 人脸识别 - 图片为本地路径 imagePath 本地图片路径 groupId 候选人组ID(个体创建时设定) topns 返回的候选人个数(默认9个)

func (*TxAi) FaceFaceshapeForBase64

func (ai *TxAi) FaceFaceshapeForBase64(image string, modes ...int) (*FaceFaceshapeResponse, error)

FaceFaceshapeForBase64 五官定位 - 图片为base64格式 image 图片base64后字符串 modes 检测模式,0-正常,1-大脸模式(默认1)

func (*TxAi) FaceFaceshapeForPath

func (ai *TxAi) FaceFaceshapeForPath(imagePath string, modes ...int) (*FaceFaceshapeResponse, error)

FaceFaceshapeForPath 五官定位 - 图片为本地路径 imagePath 本地图片路径 modes 检测模式,0-正常,1-大脸模式(默认1)

func (*TxAi) FaceFaceverifyForBase64

func (ai *TxAi) FaceFaceverifyForBase64(image, personId string) (*FaceFaceverifyResponse, error)

FaceFaceverifyForBase64 人脸验证 - 图片为base64格式 image 图片base64后字符串 personId 待验证的个体(Person)ID

func (*TxAi) FaceFaceverifyForPath

func (ai *TxAi) FaceFaceverifyForPath(imagePath, personId string) (*FaceFaceverifyResponse, error)

FaceFaceverifyForPath 人脸验证 - 图片为本地路径 imagePath 本地图片路径 personId 待验证的个体(Person)ID

func (*TxAi) FaceGetfaceidsAllForPersonId

func (ai *TxAi) FaceGetfaceidsAllForPersonId(personId string) (*FaceGetfaceidsResponse, error)

FaceGetfaceidsAllForPersonId 获取人脸列表 - 根据个体(Person)ID 获取人脸(Face)ID列表

func (*TxAi) FaceGetfaceinfoForFaceId

func (ai *TxAi) FaceGetfaceinfoForFaceId(faceId string) (*FaceGetfaceinfoResponse, error)

FaceGetfaceinfoForFaceId 获取人脸信息 - 根据人脸(Face)ID 获取人脸(Face)信息

func (*TxAi) FaceGetgroupidsAll

func (ai *TxAi) FaceGetgroupidsAll() (*FaceGetgroupidsResponse, error)

FaceGetgroupidsAll 获取组列表 - 获取应用下所有的组(Group)ID列表

func (*TxAi) FaceGetinfoForPersonId

func (ai *TxAi) FaceGetinfoForPersonId(personId string) (*FaceGetinfoResponse, error)

FaceGetinfoForPersonId 增加人脸 personId 指定的个体(Person)ID

func (*TxAi) FaceGetpersonidsAllForGroupId

func (ai *TxAi) FaceGetpersonidsAllForGroupId(groupId string) (*FaceGetpersonidsResponse, error)

FaceGetpersonidsAllForGroupId 获取个体列表 - 获取一个组(Group)中的所有个体(Person)ID

func (*TxAi) FaceNewpersonForBase64

func (ai *TxAi) FaceNewpersonForBase64(groupIds, personId, image, personName string, tags ...string) (*FaceNewpersonResponse, error)

FaceNewpersonForBase64 个体创建 - 图片为base64格式 groupIds 个体组,可以用|分开多个组 personId 指定的个体(Person)ID image 图片base64后字符串 personName 个体名称 tags 备注信息

func (*TxAi) FaceNewpersonForPath

func (ai *TxAi) FaceNewpersonForPath(groupIds, personId, imagePath, personName string, tags ...string) (*FaceNewpersonResponse, error)

FaceNewpersonForPath 个体创建 - 图片为本地路径 groupIds 个体组,可以用|分开多个组 personId 指定的个体(Person)ID imagePath 本地图片路径 personName 个体名称 tags 备注信息

func (*TxAi) FaceSetinfoForPersonId

func (ai *TxAi) FaceSetinfoForPersonId(personId, personName, tag string) (*FaceSetinfoResponse, error)

FaceSetinfoForPersonId 设置信息 personId 指定的个体(Person)ID personName 新的名字 tag 备注信息

func (*TxAi) HttpGet added in v1.0.2

func (ai *TxAi) HttpGet(url string, u url.Values) (respBody []byte, err error)

HttpGet 发起GET请求

func (*TxAi) HttpPost

func (ai *TxAi) HttpPost(url string, u url.Values) (respBody []byte, err error)

HttpPost 发起POST请求

func (*TxAi) ImageFoodForBase64

func (ai *TxAi) ImageFoodForBase64(image string) (*ImageFoodResponse, error)

ImageFoodForBase64 美食图片识别 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) ImageFoodForPath

func (ai *TxAi) ImageFoodForPath(imagePath string) (*ImageFoodResponse, error)

ImageFoodForPath 美食图片识别 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) ImageFuzzyForBase64

func (ai *TxAi) ImageFuzzyForBase64(image string) (*ImageFuzzyResponse, error)

ImageFuzzyForBase64 模糊图片检测 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) ImageFuzzyForPath

func (ai *TxAi) ImageFuzzyForPath(imagePath string) (*ImageFuzzyResponse, error)

ImageFuzzyForPath 模糊图片检测 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) ImageTagForBase64

func (ai *TxAi) ImageTagForBase64(image string) (*ImageTagResponse, error)

ImageTagForBase64 图像标签识别 - 图片为base64格式 识别一个图像的标签信息,对图像分类。 image 图片base64后字符串

func (*TxAi) ImageTagForPath

func (ai *TxAi) ImageTagForPath(imagePath string) (*ImageTagResponse, error)

ImageTagForPath 图像标签识别 - 图片为本地路径 识别一个图像的标签信息,对图像分类。 imagePath 本地图片路径

func (*TxAi) ImageTerrorismForBase64

func (ai *TxAi) ImageTerrorismForBase64(image string) (*ImageTerrorismResponse, error)

ImageTerrorismForBase64 营业执照OCR识别 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) ImageTerrorismForPath

func (ai *TxAi) ImageTerrorismForPath(imagePath string) (*ImageTerrorismResponse, error)

ImageTerrorismForPath 营业执照OCR识别 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) NlpImagetranslateForBase64

func (ai *TxAi) NlpImagetranslateForBase64(image, sessionId string, scene SceneType, source, target Lang) (*NlpImagetranslateResponse, error)

NlpImagetranslateForBase64 图片翻译 - 图片为base64格式 image 图片base64后字符串 sessionId 一次请求ID 一次请求ID(尽可能唯一,长度上限64字节) scene 识别类型(word-单词识别,doc-文档识别) source 源语言缩写,详细见下文 target 目标语言缩写,详细见下文

func (*TxAi) NlpImagetranslateForPath

func (ai *TxAi) NlpImagetranslateForPath(imagePath, sessionId, scene string, source, target Lang) (*NlpImagetranslateResponse, error)

NlpImagetranslateForPath 图片翻译 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) NlpSpeechtranslateForBase64

func (ai *TxAi) NlpSpeechtranslateForBase64(speechChunk, sessionId string, format FormatAudioType, seq, end uint, source, target Lang) (*NlpSpeechtranslateResponse, error)

NlpSpeechtranslateForBase64 语音翻译 - 音频为base64格式 speechChunk 待识别语音分片 sessionId 一次请求ID 一次请求ID(尽可能唯一,长度上限64字节) format 语音压缩格式编码,定义见下文描述 枚举FormatAudioType seq 语音分片所在语音流的偏移量(字节) end 是否结束分片标识,定义见下文描述 source 源语言缩写,详细见下文 target 目标语言缩写,详细见下文

func (*TxAi) NlpSpeechtranslateForPath

func (ai *TxAi) NlpSpeechtranslateForPath(speechChunkPath, sessionId string, format FormatAudioType, seq, end uint, source, target Lang) (*NlpSpeechtranslateResponse, error)

NlpSpeechtranslateForPath 语音翻译 - 音频为本地路径 speechChunkPath 本地图片路径 sessionId 一次请求ID 一次请求ID(尽可能唯一,长度上限64字节) format 语音压缩格式编码,定义见下文描述 枚举FormatAudioType seq 语音分片所在语音流的偏移量(字节) end 是否结束分片标识,定义见下文描述 source 源语言缩写,详细见下文 target 目标语言缩写,详细见下文

func (*TxAi) NlpTextchatForText

func (ai *TxAi) NlpTextchatForText(session, question string) (*NlpTextchatResponse, error)

NlpTextchatForText 智能闲聊 - 基础闲聊 session 会话标识(应用内唯一) question 用户输入的聊天内容

func (*TxAi) NlpTextdetectForText

func (ai *TxAi) NlpTextdetectForText(text string, force bool, candidateLangs ...Lang) (*NlpTextdetectResponse, error)

NlpTextdetectForText 语种识别 - 对文本进行翻译,支持多种语言之间互译 text 待翻译文本 force 是否强制从候选语言中选择(只对二选一有效) candidateLangs 备选语言缩写,详细见 https://ai.qq.com/doc/textdetect.shtml

func (*TxAi) NlpTextpolarForText

func (ai *TxAi) NlpTextpolarForText(text string) (*NlpTextpolarResponse, error)

NlpTextpolarForText 情感分析 - 对文本进行情感分析,快速判断情感倾向(正面或负面) text 待分析文本

func (*TxAi) NlpTexttransForText

func (ai *TxAi) NlpTexttransForText(text string, langTypes ...LangType) (*NlpTexttransResponse, error)

NlpTexttransForText 文本翻译(AI Lab) - 对文本进行翻译,支持多种语言之间互译 text 待翻译文本 langType 翻译类型,默认为0,详细见下文

func (*TxAi) NlpTexttranslateForText

func (ai *TxAi) NlpTexttranslateForText(text string, source, target Lang) (*NlpTexttranslateResponse, error)

NlpTexttranslateForText 文本翻译(翻译君) - 对文本进行翻译,支持多种语言之间互译 text 待翻译文本 langType 翻译类型,默认为0,详细见下文

func (*TxAi) NlpWordcomForText

func (ai *TxAi) NlpWordcomForText(text string) (*NlpWordcomResponse, error)

NlpWordcomForText 语义解析 - 对文本进行意图识别,快速找出意图及上下文成分 text 待分析文本

func (*TxAi) NlpWordnerForText

func (ai *TxAi) NlpWordnerForText(text string) (*NlpWordnerResponse, error)

NlpWordnerForText 专有名词识别 - 对文本进行专有名词的分词识别,找出文本中的专有名词 text 待分析文本

func (*TxAi) NlpWordposForText

func (ai *TxAi) NlpWordposForText(text string) (*NlpWordposResponse, error)

NlpWordposForText 词性标注 - 对文本进行分词,同时为每个分词标注正确的词性 text 待分析文本

func (*TxAi) NlpWordsegForText

func (ai *TxAi) NlpWordsegForText(text string) (*NlpWordsegResponse, error)

NlpWordsegForText 分词 - 对文本进行智能分词识别,支持基础词与混排词粒度 text 待分析文本

func (*TxAi) NlpWordsynForText

func (ai *TxAi) NlpWordsynForText(text string) (*NlpWordsynResponse, error)

NlpWordsynForText 同义词识别 - 识别文本中存在同义词的分词,并返回相应的同义词 text 待分析文本

func (*TxAi) OcrBcocrForBase64

func (ai *TxAi) OcrBcocrForBase64(image string) (*OcrResponse, error)

OcrBcocrForBase64 名片OCR识别 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) OcrBcocrForPath

func (ai *TxAi) OcrBcocrForPath(imagePath string) (*OcrResponse, error)

OcrBcocrForPath 名片OCR识别 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) OcrBizlicenseocrForBase64

func (ai *TxAi) OcrBizlicenseocrForBase64(image string) (*OcrResponse, error)

OcrBizlicenseocrForBase64 营业执照OCR识别 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) OcrBizlicenseocrForPath

func (ai *TxAi) OcrBizlicenseocrForPath(imagePath string) (*OcrResponse, error)

OcrBizlicenseocrForPath 营业执照OCR识别 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) OcrCreditcardocrForBase64

func (ai *TxAi) OcrCreditcardocrForBase64(image string) (*OcrResponse, error)

OcrCreditcardocrForBase64 银行卡OCR识别 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) OcrCreditcardocrForPath

func (ai *TxAi) OcrCreditcardocrForPath(imagePath string) (*OcrResponse, error)

OcrCreditcardocrForPath 银行卡OCR识别 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) OcrDriverlicenseocrForBase64

func (ai *TxAi) OcrDriverlicenseocrForBase64(t int, image string) (*OcrResponse, error)

OcrDriverlicenseocrForBase64 行驶证驾驶证OCR识别 - 图片为base64格式 t 识别类型,0-行驶证识别,1-驾驶证识别 image 图片base64后字符串

func (*TxAi) OcrDriverlicenseocrForPath

func (ai *TxAi) OcrDriverlicenseocrForPath(t int, imagePath string) (*OcrResponse, error)

OcrDriverlicenseocrForPath 行驶证驾驶证OCR识别 - 图片为本地路径 t 识别类型,0-行驶证识别,1-驾驶证识别 imagePath 本地图片路径

func (*TxAi) OcrGeneralocrForBase64

func (ai *TxAi) OcrGeneralocrForBase64(image string) (*OcrResponse, error)

OcrGeneralocrForBase64 银行卡OCR识别 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) OcrGeneralocrForPath

func (ai *TxAi) OcrGeneralocrForPath(imagePath string) (*OcrResponse, error)

OcrGeneralocrForPath 银行卡OCR识别 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) OcrHandwritingocrForBase64

func (ai *TxAi) OcrHandwritingocrForBase64(image string) (*OcrResponse, error)

OcrHandwritingocrForBase64 手写体OCR - 检测和识别图像上面手写体的字段信息 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) OcrHandwritingocrForPath

func (ai *TxAi) OcrHandwritingocrForPath(imagePath string) (*OcrResponse, error)

OcrHandwritingocrForPath 手写体OCR - 检测和识别图像上面手写体的字段信息 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) OcrHandwritingocrForURL

func (ai *TxAi) OcrHandwritingocrForURL(imageURL string) (*OcrResponse, error)

OcrHandwritingocrForURL 手写体OCR - 检测和识别图像上面手写体的字段信息 - 图片为url地址 imageURL 待识别图片url

func (*TxAi) OcrIdcardocrForBase64

func (ai *TxAi) OcrIdcardocrForBase64(cardType int, image string) (*OcrIDCardResponse, error)

OcrIdcardocrForBase64 身份证OCR识别 - 图片为base64格式 cardType 身份证图片类型,0-正面,1-反面 image 图片base64后字符串

func (*TxAi) OcrIdcardocrForPath

func (ai *TxAi) OcrIdcardocrForPath(cardType int, imagePath string) (*OcrIDCardResponse, error)

OcrIdcardocrForPath 身份证OCR识别 - 图片为本地路径 cardType 身份证图片类型,0-正面,1-反面 imagePath 本地图片路径

func (*TxAi) OcrPlateocrForBase64

func (ai *TxAi) OcrPlateocrForBase64(image string) (*OcrResponse, error)

OcrPlateocrForBase64 车牌OCR - 识别车牌上面的字段信息 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) OcrPlateocrForPath

func (ai *TxAi) OcrPlateocrForPath(imagePath string) (*OcrResponse, error)

OcrPlateocrForPath 车牌OCR - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) OcrPlateocrForURL

func (ai *TxAi) OcrPlateocrForURL(imageURL string) (*OcrResponse, error)

OcrPlateocrForURL 车牌OCR - 识别车牌上面的字段信息 - 图片为url地址 imageURL 待识别图片url

func (*TxAi) PtuFaceageForBase64

func (ai *TxAi) PtuFaceageForBase64(image string) (*PtuResponse, error)

PtuFaceageForBase64 颜龄检测 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) PtuFaceageForPath

func (ai *TxAi) PtuFaceageForPath(imagePath string) (*PtuResponse, error)

PtuFaceageForPath 颜龄检测 - 图片为本地路径 image 图片base64后字符串 sticker 变妆编码,定义见 https://ai.qq.com/doc/facesticker.shtml

func (*TxAi) PtuFacecosmeticForBase64

func (ai *TxAi) PtuFacecosmeticForBase64(image string, cosmetic int) (*PtuResponse, error)

PtuFacecosmeticForBase64 人脸美妆 - 图片为base64格式 image 图片base64后字符串 cosmetic 美妆编码,定义见 https://ai.qq.com/doc/facecosmetic.shtml

func (*TxAi) PtuFacecosmeticForPath

func (ai *TxAi) PtuFacecosmeticForPath(imagePath string, cosmetic int) (*PtuResponse, error)

PtuFacecosmeticForPath 人脸美妆 - 图片为本地路径 imagePath 本地图片路径 cosmetic 美妆编码,定义见 https://ai.qq.com/doc/facecosmetic.shtml

func (*TxAi) PtuFacedecorationForBase64

func (ai *TxAi) PtuFacedecorationForBase64(image string, decoration int) (*PtuResponse, error)

PtuFacedecorationForBase64 人脸变妆 - 图片为base64格式 image 图片base64后字符串 decoration 变妆编码,定义见 https://ai.qq.com/doc/facedecoration.shtml

func (*TxAi) PtuFacedecorationForPath

func (ai *TxAi) PtuFacedecorationForPath(imagePath string, decoration int) (*PtuResponse, error)

PtuFacedecorationForPath 人脸变妆 - 图片为本地路径 imagePath 本地图片路径 decoration 变妆编码,定义见 https://ai.qq.com/doc/facedecoration.shtml

func (*TxAi) PtuFacemergeForBase64

func (ai *TxAi) PtuFacemergeForBase64(image string, model int) (*PtuResponse, error)

PtuFacemergeForBase64 人脸融合 - 图片为base64格式 image 图片base64后字符串 model 变妆编码,定义见 https://ai.qq.com/doc/facemerge.shtml

func (*TxAi) PtuFacemergeForPath

func (ai *TxAi) PtuFacemergeForPath(imagePath string, model int) (*PtuResponse, error)

PtuFacemergeForPath 人脸融合 - 图片为本地路径 image 图片base64后字符串 model 变妆编码,定义见 https://ai.qq.com/doc/facemerge.shtml

func (*TxAi) PtuFacestickerForBase64

func (ai *TxAi) PtuFacestickerForBase64(image string, sticker int) (*PtuResponse, error)

PtuFacestickerForBase64 大头贴 - 图片为base64格式 image 图片base64后字符串 sticker 变妆编码,定义见 https://ai.qq.com/doc/facesticker.shtml

func (*TxAi) PtuFacestickerForPath

func (ai *TxAi) PtuFacestickerForPath(imagePath string, sticker int) (*PtuResponse, error)

PtuFacestickerForPath 大头贴 - 图片为本地路径 image 图片base64后字符串 sticker 变妆编码,定义见 https://ai.qq.com/doc/facesticker.shtml

func (*TxAi) PtuImgfilterForBase64

func (ai *TxAi) PtuImgfilterForBase64(image string, filter int) (*PtuResponse, error)

PtuImgfilterForBase64 图片滤镜(天天P图) - 图片为base64格式 image 图片base64后字符串 filter 变妆编码,定义见 https://ai.qq.com/doc/ptuimgfilter.shtml

func (*TxAi) PtuImgfilterForPath

func (ai *TxAi) PtuImgfilterForPath(imagePath string, filter int) (*PtuResponse, error)

PtuImgfilterForPath 图片滤镜(天天P图) - 图片为本地路径 imagePath 本地图片路径 filter 变妆编码,定义见 https://ai.qq.com/doc/ptuimgfilter.shtml

func (*TxAi) RequestAPI

func (ai *TxAi) RequestAPI(uri string, u url.Values, response BaseResponseInterface) (err error)

RequestAPI 发起请求,并解析响应结果

func (*TxAi) SetDebug

func (ai *TxAi) SetDebug(debug bool)

SetDebug 设置是否调试模式

func (*TxAi) SetRequestTimeout

func (ai *TxAi) SetRequestTimeout(d time.Duration)

SetRequestTimeout 设置超时时间

func (*TxAi) URLToBase64

func (ai *TxAi) URLToBase64(imageURL string) (string, error)

URLToBase64 读取url返回base64字符串

func (*TxAi) VisionImgfilterForBase64

func (ai *TxAi) VisionImgfilterForBase64(image, sessionId string, filter int) (*PtuResponse, error)

VisionImgfilterForBase64 图片滤镜(AI Lab) - 图片为base64格式 image 图片base64后字符串 session_id 一次请求ID 尽可能唯一,长度上限64字节 filter 变妆编码,定义见 https://ai.qq.com/doc/ptuimgfilter.shtml

func (*TxAi) VisionImgfilterForPath

func (ai *TxAi) VisionImgfilterForPath(imagePath, sessionId string, filter int) (*PtuResponse, error)

VisionImgfilterForPath 图片滤镜(AI Lab) - 图片为本地路径 imagePath 本地图片路径 session_id 一次请求ID 尽可能唯一,长度上限64字节 filter 变妆编码,定义见 https://ai.qq.com/doc/ptuimgfilter.shtml

func (*TxAi) VisionImgtotextForBase64

func (ai *TxAi) VisionImgtotextForBase64(image, sessionId string) (*VisionImgtotextResponse, error)

VisionImgtotextForBase64 看图说话 - 图片为base64格式 image 图片base64后字符串 sessionId 一次请求ID 尽可能唯一,长度上限64字节

func (*TxAi) VisionImgtotextForPath

func (ai *TxAi) VisionImgtotextForPath(imagePath, sessionId string) (*VisionImgtotextResponse, error)

VisionImgtotextForPath 行驶证驾驶证OCR识别 - 图片为本地路径 imagePath 本地图片路径 sessionId 一次请求ID 尽可能唯一,长度上限64字节

func (*TxAi) VisionObjectrForBase64

func (ai *TxAi) VisionObjectrForBase64(image string, format, topk int) (*VisionObjectrResponse, error)

VisionObjectrForBase64 物体识别 - 图片为base64格式 对图片进行物体识别,快速找出图片中包含的物体信息 image 图片base64后字符串 format 图片格式,暂时只支持1 JPG格式(image/jpeg) topk 返回结果个数(已按置信度倒排)

func (*TxAi) VisionObjectrForPath

func (ai *TxAi) VisionObjectrForPath(imagePath string, format, topk int) (*VisionObjectrResponse, error)

VisionObjectrForPath 物体识别 - 图片为本地路径 对图片进行物体识别,快速找出图片中包含的物体信息 imagePath 本地图片路径 format 图片格式,暂时只支持1 JPG格式(image/jpeg) topk 返回结果个数(已按置信度倒排)

func (*TxAi) VisionPornForBase64

func (ai *TxAi) VisionPornForBase64(image string) (*VisionPornResponse, error)

VisionPornForBase64 智能鉴黄 - 图片为base64格式 image 图片base64后字符串

func (*TxAi) VisionPornForPath

func (ai *TxAi) VisionPornForPath(imagePath string) (*VisionPornResponse, error)

VisionPornForPath 智能鉴黄 - 图片为本地路径 imagePath 本地图片路径

func (*TxAi) VisionScenerForBase64

func (ai *TxAi) VisionScenerForBase64(image string, format, topk int) (*VisionScenerResponse, error)

VisionScenerForBase64 场景识别 - 图片为base64格式 对图片进行场景识别,快速找出图片中包含的场景信息 image 图片base64后字符串 format 图片格式,暂时只支持1 JPG格式(image/jpeg) topk 返回结果个数(已按置信度倒排)

func (*TxAi) VisionScenerForPath

func (ai *TxAi) VisionScenerForPath(imagePath string, format, topk int) (*VisionScenerResponse, error)

VisionScenerForPath 场景识别 - 图片为本地路径 对图片进行场景识别,快速找出图片中包含的场景信息 imagePath 本地图片路径 format 图片格式,暂时只支持1 JPG格式(image/jpeg) topk 返回结果个数(已按置信度倒排)

type VisionImgtotextResponse

type VisionImgtotextResponse struct {
	BaseResponse
	Data struct {
		Text string `json:"text"`
	} `json:"data"`
}

VisionImgtotextResponse 看图说话

type VisionObjectrResponse

type VisionObjectrResponse struct {
	BaseResponse
	Data struct {
		Topk       int `json:"topk"`
		ObjectList []*struct {
			LabelID    int     `json:"label_id"`
			LabelName  string  `json:"label_name"` // 物体名
			LabelConfd float64 `json:"label_confd"`
		} `json:"object_list"`
	} `json:"data"`
}

VisionObjectrResponse 物体识别

type VisionPornResponse

type VisionPornResponse struct {
	BaseResponse
	Level int // 图片级别 0正常、1性感、2色情
	Data  struct {
		TagList []struct {
			TagConfidence  int     `json:"tag_confidence"`
			TagConfidenceF float64 `json:"tag_confidence_f"`
			TagName        string  `json:"tag_name"`
		} `json:"tag_list"`
	} `json:"data"`
}

VisionPornResponse 智能鉴黄响应结构

type VisionScenerResponse

type VisionScenerResponse struct {
	BaseResponse
	Data struct {
		Topk      int `json:"topk"`
		SceneList []*struct {
			LabelID    int     `json:"label_id"`
			LabelName  string  `json:"label_name"` // 场景名
			LabelConfd float64 `json:"label_confd"`
		} `json:"scene_list"`
	} `json:"data"`
}

VisionScenerResponse 场景识别

Directories

Path Synopsis
aai/aai_asr command
aai/aai_tt command
image/image_tag command
nlp/base_word command
nlp/nlp_wordcom command
ocr/ocr_bcocr command
ptu/ptu_faceage command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL