| | |
| | | log.error("顶盖密闭模型调用失败:" + execute.body()); |
| | | throw new RuntimeException("顶盖密闭模型调用失败:" + execute.body()); |
| | | } |
| | | log.info("调用顶盖密闭模型结果:{}", execute.body()); |
| | | JSONObject result = JSON.parseObject(execute.body()); |
| | | JSONArray predicted_labels = result.getJSONArray("predicted_labels"); |
| | | List<String> list = new ArrayList<>(); |
| | |
| | | private static List<String> cameraFaultModel(File file){ |
| | | log.info("--------调用摄像头故障模型开始--------"); |
| | | HttpRequest post = HttpUtil.createPost("http://120.232.235.142:4000/predict"); |
| | | post.form("file", file); |
| | | post.form("file1", file); |
| | | HttpResponse execute = post.execute(); |
| | | int status = execute.getStatus(); |
| | | if(200 != status){ |
| | | log.error("摄像头故障模型调用失败:" + execute.body()); |
| | | throw new RuntimeException("摄像头故障模型调用失败:" + execute.body()); |
| | | } |
| | | JSONObject result = JSON.parseObject(execute.body()); |
| | | String predicted_labels = result.getString("predicted_label"); |
| | | log.info("调用摄像头故障模型结果:{}", execute.body()); |
| | | JSONArray result = JSON.parseArray(execute.body()); |
| | | String predicted_labels = result.getJSONObject(0).getString("predicted_label"); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(predicted_labels); |
| | | log.info("--------调用摄像头故障模型结束--------"); |