任务创建接口:http://yapi.wondershare.cn/project/676/interface/api/256259

任务查询接口:http://yapi.wondershare.cn/project/676/interface/api/256304

逻辑:

  1. 用户在HiPDF上传图片,拿到图片的file_id,如下图:

    image

  2. 通过拿这个file_id去请求AI图片检测任务创建接口(http://yapi.wondershare.cn/project/676/interface/api/256259),可以指定结果输出语言,默认英文(English),如下图:

image

如果这个图片已经处理过,就会如上图所示,在调用创建接口的时候就会直接返回已缓存结果(缓存周期30天),前端可通过is_dealed参数是否为true来判断:

当is_dealed为false时,后端会返回task_id字段,前端需要拿task_id去调用查询接口(http://yapi.wondershare.cn/project/676/interface/api/256304)轮询,如下图:

image

当is_dealed为true时,后端会返回detect_result字段,为检测结果,数据结构与查询接口的data一致,如下图:

image

AI图片检测任务创建接口请求示例:

curl --location 'https://web-api.hipdf.com/v2/image/detect' \
--header 'Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJodHRwOi8vd2ViLWFwaS5oaXBkZi5jb20iLCJhdWQiOiJodHRwczovL3d3dy5oaXBkZi5jb20iLCJqdGkiOiJUOWlGSjI1alhwIiwiaWF0IjoxNzY3NzczNTY1LjgxMzAxMywibmJmIjoxNzY3NzczNTY1LjgxMzAxMywiZXhwIjoxNzY4MDMyNzk1LjgxMzAxMywidXNlciI6eyJ1c2VyX2lkIjo3NjU1MTIsInNlc3Npb25faWQiOiJkYjUyM2RiZS03NTI3LTQ2Y2EtYjc5Mi03ZTJlOGIzMzNiMTUiLCJlbWFpbCI6InRpYW5oeUAzMDA2MjQuY24iLCJwZXJtaXNzaW9uIjo3LCJmaXJzdF9uYW1lIjoiIiwibGFzdF9uYW1lIjoiIiwiYXZhdGFyIjoiaHR0cHM6Ly9kYy1zdGF0aWMud29uZGVyc2hhcmUuY29tL3dzaWQvY29tL3N0YXRpYy9hdmF0YXIucG5nIiwiZXhwaXJlX3RpbWUiOjE4NjgxNzA5ODAsIndzX2lkIjo1NzgxOTk0ODAsImNhcmVlciI6IiIsImlzX21vdmUiOjAsIndzX3Rva2VuIjoiMF9fWjRNMVM0UjF5bWEycU1Ndnp3ekFmYXQiLCJyZWZyZXNoX3Rva2VuIjoiMFlYMFo5RzZnUnZLS1dYdTdiSEdsSVFmYXQiLCJoYXZlX3Blcm1pc3Npb24iOjEsImFpIjpmYWxzZX19.ezXoIv-0Z6RdCwt1wmHrU2Hhd_nmOhMvfP5ZqhnMqZ4QRHVI4QH9o2HxPRfJQRBZddjW4gul6dA1y0Dop-qzGQ' \
--header 'Authorization: Basic Njg4M2VmNDc5ZjZjOTFiMWUxM2ZjYmVkNDhmYjk0ZGM6Y2QyZWI0ZDM1MTNjM2QwNDgzYTMxZGEwYzBkNDhiOGU=' \
--header 'Lang: en-us' \
--header 'Content-Type: application/json' \
--data '{
    "file_id": "13e764f1f8983d96f1f93f4867bf5502"
}'
{
    "code": 0,
    "msg": "successful",
    "data": {
        "task_id": "", // 当is_dealed=false时才有值
        "is_dealed": true,
        "detect_result": {
            "probability": 0.9998999999999999,
            "understanding": [
                {
                    "title": "🏷️ Explicit Watermark",
                    "content": "The most definitive visual feature is the text watermark located in the bottom right corner of the image. It reads '豆包AI生成', which directly translates from Chinese to 'Doubao AI Generated'. This serves as an explicit declaration of the image's origin."
                },
                {
                    "title": "💡 Idealized Lighting and Composition",
                    "content": "The lighting in the image is cinematic and highly idealized. The 'rim lighting' effect on the puppy's fur—where the sun illuminates the edges to separate the subject from the background—is perfectly executed. AI image generators frequently default to this specific, aesthetically pleasing lighting style to maximize visual appeal, often resulting in a look that feels slightly 'too perfect' for a candid snapshot."
                },
                {
                    "title": "🐕 Texture and Motion Blur",
                    "content": "While the fur texture is high-resolution, it exhibits a characteristic smoothness often found in AI synthesis. The motion blur on the paws, particularly the front left paw, is effective but also convenient; AI models often use motion blur in active poses to obscure complex anatomical details like toes and claws, which are historically difficult for generators to render perfectly."
                },
                {
                    "title": "🌿 Depth of Field Simulation",
                    "content": "The image mimics a camera lens with a very shallow depth of field (low aperture), keeping the puppy sharp while heavily blurring the background grass and horizon. The transition between the sharp foreground blades of grass and the blurry background is algorithmically smooth. The clouds and sky also appear somewhat generic and stylized, lacking specific organic randomness."
                },
                {
                    "title": "📋 Summary",
                    "content": "The image is conclusively AI-generated. The primary evidence is the visible watermark stating 'AI Generated'. Supporting this, the visual aesthetics display the hyper-realistic, cinematic lighting and perfected composition that are hallmarks of high-end generative AI models."
                }
            ],
            "usage": {
                "candidates_token_count": 453,
                "candidates_tokens_details": [
                    {
                        "modality": "text",
                        "token_count": 453
                    }
                ],
                "prompt_token_count": 1592,
                "prompt_tokens_details": [
                    {
                        "modality": "image",
                        "token_count": 1100
                    },
                    {
                        "modality": "text",
                        "token_count": 492
                    }
                ],
                "thoughts_token_count": 1224,
                "total_token_count": 3269,
                "traffic_type": "ON_DEMAND"
            }
        }
    }
}

查询接口示例:

curl --location 'https://web-api.hipdf.com/v2/image/detect/result?task_id=0c282e299293c14a444699da0ef8e234' \
--header 'Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJodHRwOi8vd2ViLWFwaS5oaXBkZi5jb20iLCJhdWQiOiJodHRwczovL3d3dy5oaXBkZi5jb20iLCJqdGkiOiJUOWlGSjI1alhwIiwiaWF0IjoxNzY3NzczNTY1LjgxMzAxMywibmJmIjoxNzY3NzczNTY1LjgxMzAxMywiZXhwIjoxNzY4MDMyNzk1LjgxMzAxMywidXNlciI6eyJ1c2VyX2lkIjo3NjU1MTIsInNlc3Npb25faWQiOiJkYjUyM2RiZS03NTI3LTQ2Y2EtYjc5Mi03ZTJlOGIzMzNiMTUiLCJlbWFpbCI6InRpYW5oeUAzMDA2MjQuY24iLCJwZXJtaXNzaW9uIjo3LCJmaXJzdF9uYW1lIjoiIiwibGFzdF9uYW1lIjoiIiwiYXZhdGFyIjoiaHR0cHM6Ly9kYy1zdGF0aWMud29uZGVyc2hhcmUuY29tL3dzaWQvY29tL3N0YXRpYy9hdmF0YXIucG5nIiwiZXhwaXJlX3RpbWUiOjE4NjgxNzA5ODAsIndzX2lkIjo1NzgxOTk0ODAsImNhcmVlciI6IiIsImlzX21vdmUiOjAsIndzX3Rva2VuIjoiMF9fWjRNMVM0UjF5bWEycU1Ndnp3ekFmYXQiLCJyZWZyZXNoX3Rva2VuIjoiMFlYMFo5RzZnUnZLS1dYdTdiSEdsSVFmYXQiLCJoYXZlX3Blcm1pc3Npb24iOjEsImFpIjpmYWxzZX19.ezXoIv-0Z6RdCwt1wmHrU2Hhd_nmOhMvfP5ZqhnMqZ4QRHVI4QH9o2HxPRfJQRBZddjW4gul6dA1y0Dop-qzGQ' \
--header 'Authorization: Basic Njg4M2VmNDc5ZjZjOTFiMWUxM2ZjYmVkNDhmYjk0ZGM6Y2QyZWI0ZDM1MTNjM2QwNDgzYTMxZGEwYzBkNDhiOGU=' \
--header 'Lang: en-us'
{
    "code": 0,
    "msg": "successful",
    "data": {
        "probability": 0.9998999999999999,
        "understanding": [
            {
                "title": "🏷️ Explicit Watermark",
                "content": "The most definitive visual feature is the text watermark located in the bottom right corner of the image. It reads '豆包AI生成', which directly translates from Chinese to 'Doubao AI Generated'. This serves as an explicit declaration of the image's origin."
            },
            {
                "title": "💡 Idealized Lighting and Composition",
                "content": "The lighting in the image is cinematic and highly idealized. The 'rim lighting' effect on the puppy's fur—where the sun illuminates the edges to separate the subject from the background—is perfectly executed. AI image generators frequently default to this specific, aesthetically pleasing lighting style to maximize visual appeal, often resulting in a look that feels slightly 'too perfect' for a candid snapshot."
            },
            {
                "title": "🐕 Texture and Motion Blur",
                "content": "While the fur texture is high-resolution, it exhibits a characteristic smoothness often found in AI synthesis. The motion blur on the paws, particularly the front left paw, is effective but also convenient; AI models often use motion blur in active poses to obscure complex anatomical details like toes and claws, which are historically difficult for generators to render perfectly."
            },
            {
                "title": "🌿 Depth of Field Simulation",
                "content": "The image mimics a camera lens with a very shallow depth of field (low aperture), keeping the puppy sharp while heavily blurring the background grass and horizon. The transition between the sharp foreground blades of grass and the blurry background is algorithmically smooth. The clouds and sky also appear somewhat generic and stylized, lacking specific organic randomness."
            },
            {
                "title": "📋 Summary",
                "content": "The image is conclusively AI-generated. The primary evidence is the visible watermark stating 'AI Generated'. Supporting this, the visual aesthetics display the hyper-realistic, cinematic lighting and perfected composition that are hallmarks of high-end generative AI models."
            }
        ],
        "usage": {
            "candidates_token_count": 453,
            "candidates_tokens_details": [
                {
                    "modality": "text",
                    "token_count": 453
                }
            ],
            "prompt_token_count": 1592,
            "prompt_tokens_details": [
                {
                    "modality": "image",
                    "token_count": 1100
                },
                {
                    "modality": "text",
                    "token_count": 492
                }
            ],
            "thoughts_token_count": 1224,
            "total_token_count": 3269,
            "traffic_type": "ON_DEMAND"
        }
    }
}

为了便于测试和产品计算成本,暂时会返回usage字段展示本次请求消耗的token情况,前端不要管这个usage字段:

image

备注:

1、为了确保同一张图片检测结果一致,后端设置了缓存机制:同一设备,同一张图片(在同一个语言)在30天内再次解析,直接调用上次的检测结果;此时前端需要loading 5s即可;如果语言有变化,同一张图片会重新检测返回结果

2、测试时,可以统计100张图片的总消耗token,计算评价一张图片大致消耗量@朱菲