Documentation ¶
Index ¶
Constants ¶
View Source
const (
Dish = "https://aip.baidubce.com/rest/2.0/image-classify/v2/dish"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DishRequest ¶
type DishRequest struct { Image string `url:"image,omitempty" form:"image,omitempty" json:"image,omitempty"` // 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式。注意:图片需要base64编码、去掉编码头(data:image/jpg;base64,)后,再进行urlencode。 URL string `url:"url,omitempty" form:"url,omitempty" json:"url,omitempty"` // 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效。 TopNum uint32 `url:"top_num,omitempty" form:"top_num,omitempty" json:"top_num,omitempty"` // 返回结果top n,默认5. FilterThreshold float32 `url:"filter_threshold,omitempty" form:"filter_threshold,omitempty" json:"filter_threshold,omitempty"` // 默认0.95,可以通过该参数调节识别效果,降低非菜识别率. BaikeNum int `url:"baike_num,omitempty" form:"baike_num,omitempty" json:"baike_num,omitempty"` // 用于控制返回结果是否带有百科信息,若不输入此参数,则默认不返回百科结果;若输入此参数,会根据输入的整数返回相应个数的百科信息 }
type DishResponse ¶
type DishResponse struct { Result []struct { Probability string `json:"probability"` HasCalorie bool `json:"has_calorie"` Calorie string `json:"calorie"` Name string `json:"name"` BaikeInfo struct { BaikeURL string `json:"baike_url"` Description string `json:"description"` } `json:"baike_info"` } `json:"result"` ResultNum int `json:"result_num"` LogID int64 `json:"log_id"` ErrorMsg string `json:"error_msg,omitempty"` ErrorCode int `json:"error_code,omitempty"` }
type Service ¶
type Service interface {
Dish(in DishRequest) (DishResponse, error)
}
Click to show internal directories.
Click to hide internal directories.