{
    "openapi": "3.0.0",
    "info": {
        "title": "菜品热量识别 - API文档",
        "version": "1.0.0",
        "description": "该接口支持菜品卡路里热量识别查询，支持图像base64和图像url（二选一）两种传递资源的方式。如使用图像base64的方式，则使用img参数，其值为图片的base64编码（建议URLEncoder下），大小不超过6M。如使用图片url的方式，则使用imgurl参数，其值应为一个服务稳定的图像url地址。热量结果仅供参考，不作为体重管理依据。"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/imgcaipin\/index": {
            "post": {
                "summary": "菜品热量查询",
                "tags": [
                    "菜品热量识别"
                ],
                "description": "通过图片url或图片base64识别查询菜品及热量数据",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "img": {
                                        "type": "string",
                                        "example": "base64",
                                        "description": "图片base64编码（与imgurl参数二选一）"
                                    },
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "imgurl": {
                                        "type": "string",
                                        "example": "https:\/\/www.tianapi.com\/static\/img\/ocr\/kaorou.jpg",
                                        "description": "图片URL地址（支持jpg\/png\/bmp格式）"
                                    }
                                },
                                "required": [
                                    "img",
                                    "key"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": "string",
                                            "example": "五花肉",
                                            "description": "菜品名称"
                                        },
                                        "trust": {
                                            "type": "string",
                                            "example": "0.421605",
                                            "description": "置信度"
                                        },
                                        "calorie": {
                                            "type": "string",
                                            "example": "568",
                                            "description": "卡路里热量"
                                        },
                                        "has_calorie": {
                                            "type": "boolean",
                                            "example": "true",
                                            "description": "是否含有热量数据"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "list": [
                                            {
                                                "name": "五花肉",
                                                "trust": "0.421605",
                                                "calorie": "568",
                                                "has_calorie": true
                                            },
                                            {
                                                "name": "牛五花",
                                                "trust": "0.171865",
                                                "calorie": "",
                                                "has_calorie": false
                                            },
                                            {
                                                "name": "肥牛",
                                                "trust": "0.0589951",
                                                "calorie": "125",
                                                "has_calorie": true
                                            },
                                            {
                                                "name": "牛排",
                                                "trust": "0.0557427",
                                                "calorie": "125",
                                                "has_calorie": true
                                            },
                                            {
                                                "name": "牛肋条",
                                                "trust": "0.0460706",
                                                "calorie": "127",
                                                "has_calorie": true
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}