Browse Source

intelligence

sd
ccsens_wu 3 years ago
parent
commit
dffab7e875
  1. 17
      ht/src/main/java/com/ccsens/ht/service/IntelligenceService.java

17
ht/src/main/java/com/ccsens/ht/service/IntelligenceService.java

@ -61,18 +61,8 @@ public class IntelligenceService implements IIntelligenceService {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
switch (url.getType()) { switch (url.getType()) {
case Constant.Intelligence.METHOD_TYPE_PYTHON: case Constant.Intelligence.METHOD_TYPE_PYTHON:
String path = PropUtil.path + "python/" + param.getPatientReportId() + "/" + param.getQuestionId() + ".txt"; // String path = "/home/cloud/python/code/yolo/";
File file = new File(path); // File file = new File(path);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
String python = url.getUrl().replace("{img}", getImg(param.getUrl())); String python = url.getUrl().replace("{img}", getImg(param.getUrl()));
log.info("python:{}", python); log.info("python:{}", python);
Process proc = null; Process proc = null;
@ -80,7 +70,7 @@ public class IntelligenceService implements IIntelligenceService {
String line = null; String line = null;
try { try {
proc = Runtime.getRuntime().exec(python, null, file); proc = Runtime.getRuntime().exec(python);
// InputStream inputStream = proc.getInputStream(); // InputStream inputStream = proc.getInputStream();
// byte[] buf = new byte[1024]; // byte[] buf = new byte[1024];
@ -90,6 +80,7 @@ public class IntelligenceService implements IIntelligenceService {
// } // }
in = new BufferedReader(new InputStreamReader(proc.getInputStream())); in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
log.info("line:{}", line);
builder.append(line); builder.append(line);
} }
in.close(); in.close();

Loading…
Cancel
Save