Browse Source

intelligence

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

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

@ -61,26 +61,16 @@ public class IntelligenceService implements IIntelligenceService {
StringBuilder builder = new StringBuilder();
switch (url.getType()) {
case Constant.Intelligence.METHOD_TYPE_PYTHON:
String path = PropUtil.path + "python/" + param.getPatientReportId() + "/" + param.getQuestionId() + ".txt";
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 path = "/home/cloud/python/code/yolo/";
// File file = new File(path);
String python = url.getUrl().replace("{img}", getImg(param.getUrl()));
log.info("python:{}", python);
Process proc = null;
BufferedReader in = null;
String line = null;
try {
proc = Runtime.getRuntime().exec(python, null, file);
proc = Runtime.getRuntime().exec(python);
// InputStream inputStream = proc.getInputStream();
// byte[] buf = new byte[1024];
@ -90,6 +80,7 @@ public class IntelligenceService implements IIntelligenceService {
// }
in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
while ((line = in.readLine()) != null) {
log.info("line:{}", line);
builder.append(line);
}
in.close();

Loading…
Cancel
Save