Skip to content

Commit

Permalink
avoid loading other engines versions
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Dec 15, 2023
1 parent 1ff57d9 commit 2376371
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
Expand All @@ -55,7 +54,6 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -151,6 +149,10 @@ public class Tensorflow1Interface 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 1 model
Expand Down Expand Up @@ -678,6 +680,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 = Tensorflow1Interface.class.getName();
Expand Down

0 comments on commit 2376371

Please sign in to comment.