package com.huimv.admin.analyse;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;

import com.baidu.aip.util.Base64Util;
import com.huimv.admin.utils.HttpUtils;
import org.json.JSONObject;

import com.baidu.aip.face.AipFace;


public class  Test {
    public static void main(String[] args) throws Exception {
        /****************/
        String Filepath = "G:/BaiduNetdiskDownload/pc/wallhaven-9mxjqk.png";
        String image = Base64Util.encode(Filepath.getBytes());
        String url = "https://aip.baidubce.com/rest/2.0/face/v1/detect";
        String params = URLEncoder.encode("image", "UTF-8") + "=" + URLEncoder.encode(image, "UTF-8") + "&face_fields=age,beauty,expression,gender,glasses,race,qualities";
        try {
            HttpUtils httpUtil = new HttpUtils();
            String result = HttpUtils.post(url, "24.2f135b4b7f7e21953a7cd9dacc14586b.2592000.1611635464.282335-23396383", params);
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
