| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | //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); |
| | | // } |
| | | // } |
| | | //} |