jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java
对比新文件 @@ -0,0 +1,27 @@ package com.lanbao; import ai.djl.modality.Classifications; import org.jeecg.modules.dry.util.HerbUtil; import org.junit.Test; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.List; public class AiTest { @Test public void test() { try { String img = "E:\\testImg\\szp1.jpg"; HerbUtil herbUtil = new HerbUtil(); File file = new File(img); InputStream is = new FileInputStream(file); List<Classifications.Classification> predict = herbUtil.predict(is); System.out.println(predict); } catch (FileNotFoundException e) { throw new RuntimeException(e); } } } jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java
对比新文件 @@ -0,0 +1,29 @@ package com.lanbao; import com.alibaba.fastjson.JSONObject; import org.jeecg.modules.dry.vo.SocketMsgVo; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.nio.channels.SocketChannel; public class SocketTest { public static void main(String[] args) { try { Socket socket = new Socket("192.168.2.6", 1115); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); SocketMsgVo msgVo = new SocketMsgVo(); msgVo.setCode("1"); msgVo.setMsg("1111"); oos.writeObject(JSONObject.toJSONString(msgVo)); oos.close(); socket.close(); } catch (IOException e) { throw new RuntimeException(e); } } }