Skip to content

Commit

Permalink
avoid loading incorrect engine
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Dec 15, 2023
1 parent bb2f890 commit 00509d1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ public class Tensorflow2Interface implements DeepLearningEngineInterface {
* File extension for the temporal files used for interprocessing
*/
final private static String FILE_EXTENSION = ".dat";
/**
* Name without vesion of the JAR created for this library
*/
private static final String JAR_FILE_NAME = "dl-modelrunner-tensorflow-";

/**
* The loaded Tensorflow 2 model
Expand Down Expand Up @@ -671,6 +675,8 @@ private List<String> getProcessCommandsWithoutArgs() throws IOException, URISynt
String codeSource = protectionDomain.getCodeSource().getLocation().getPath();
String f_name = URLDecoder.decode(codeSource, StandardCharsets.UTF_8.toString());
for (File ff : new File(f_name).getParentFile().listFiles()) {
if (ff.getName().startsWith(JAR_FILE_NAME) && !ff.getAbsolutePath().equals(f_name))
continue;
classpath += ff.getAbsolutePath() + File.pathSeparator;
}
String className = Tensorflow2Interface.class.getName();
Expand Down

0 comments on commit 00509d1

Please sign in to comment.