zoukankan      html  css  js  c++  java
  • 2021.5.31 团队第二阶段冲刺第八天

    今天我们进行相同图的比较

    同样出了岔子,每走一步都出岔子

    public static String SelfieAnime(byte[] file,String savePath,String suffixName) {
    // 请求url
    String url = "https://aip.baidubce.com/rest/2.0/image-process/v1/selfie_anime";
    try {
    byte[] imgData = file;
    String imgStr = Base64Util.encode(imgData);
    String imgParam = URLEncoder.encode(imgStr, "UTF-8");

    String param = "image=" + imgParam;


    String accessToken = AuthService.getAuth("uRN0ZNQEXgoKHOEIWGDX1IQb","yeFNnQlK6RVKGcNXb0RaaCeZVGL63DBo");

    JSONObject jsonObject=JSON.parseObject(HttpUtil.post(url, accessToken, param));
    String result=jsonObject.getString("image");
    if (result.equals("")){
    return "result is null";
    }
    BASE64Decoder decoder = new BASE64Decoder();
    OutputStream out = new FileOutputStream(savePath+jsonObject.getString("log_id")+"."+suffixName);
    out.write(Base64Util.decode(decoder.decodeBuffer(result)));
    out.flush();
    out.close();
    return jsonObject.getString("log_id");

    } catch (Exception e) {
    e.printStackTrace();
    return "error:e.printStackTrace()";
    }
    }
  • 相关阅读:
    Queries about less or equal elements CodeForces
    Session in BSU CodeForces
    基环树
    骑士 HYSBZ
    Valid BFS? CodeForces
    Trips CodeForces
    The writing on the wall 南京网络赛2018B题
    Building a Space Station
    Constructing Roads
    Networking
  • 原文地址:https://www.cnblogs.com/buxiang-Christina/p/14910456.html
Copyright © 2011-2022 走看看