Skip to content

Commit 96ccd19

Browse files
committed
code cosmetics
1 parent f686c26 commit 96ccd19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/io/bioimage/modelrunner/pytorch/JavaWorker.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class JavaWorker {
1616

1717
private static LinkedHashMap<String, Object> tasks = new LinkedHashMap<String, Object>();
1818

19-
private Map<String, Object> outputs;
19+
private Map<String, Object> outputs = new HashMap<String, Object>();
2020

2121
private final String uuid;
2222

@@ -96,7 +96,6 @@ private void executeScript(String script, Map<String, Object> inputs) {
9696
pi.runFromShmas((List<String>) inputs.get("inputs"), (List<String>) inputs.get("outputs"));
9797
} else if (script.equals("inference")) {
9898
List<String> encodedOutputs = pi.inferenceFromShmas((List<String>) inputs.get("inputs"));
99-
outputs = new HashMap<String, Object>();
10099
HashMap<String, List<String>> out = new HashMap<String, List<String>>();
101100
out.put("encoded", encodedOutputs);
102101
outputs.put("outputs", out);
@@ -142,7 +141,7 @@ private void respond(ResponseType responseType, Map<String, Object> args) {
142141
Map<String, Object> response = new HashMap<String, Object>();
143142
response.put("task", uuid);
144143
response.put("responseType", responseType);
145-
if (args != null)
144+
if (args != null && args.keySet().size() > 0)
146145
response.putAll(args);
147146
try {
148147
System.out.println(Types.encode(response));

0 commit comments

Comments
 (0)