Skip to content

Commit

Permalink
simplify more the ui
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Aug 7, 2024
1 parent b4c8e89 commit fc89712
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions src/main/java/ai/nets/samj/gui/SAMModelPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand All @@ -42,17 +41,10 @@
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;

import ai.nets.samj.communication.model.EfficientSAM;
import ai.nets.samj.communication.model.EfficientViTSAML0;
import ai.nets.samj.communication.model.EfficientViTSAML1;
import ai.nets.samj.communication.model.EfficientViTSAML2;
import ai.nets.samj.communication.model.EfficientViTSAMXL0;
import ai.nets.samj.communication.model.EfficientViTSAMXL1;
import ai.nets.samj.communication.model.SAMModel;
import ai.nets.samj.communication.model.SAMModels;
import ai.nets.samj.gui.components.GridPanel;
import ai.nets.samj.gui.components.HTMLPane;
import ai.nets.samj.gui.tools.Files;
import ai.nets.samj.install.SamEnvManagerAbstract;
import io.bioimage.modelrunner.apposed.appose.Mamba;

Expand Down Expand Up @@ -375,38 +367,8 @@ private void uninstallModel() {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (getSelectedModel().getName().equals(EfficientSAM.FULL_NAME)) {
Files.deleteFolder(new File(manager.getEfficientSAMPythonEnv()));
Files.deleteFolder(new File(manager.getEfficientSamEnv()));
getSelectedModel().setInstalled(false);
} else if (getSelectedModel().getName().equals(EfficientViTSAML0.FULL_NAME)
&& new File(manager.getEfficientViTSAMWeightsPath("l0")).getParentFile().list().length != 1) {
Files.deleteFolder(new File(manager.getEfficientViTSAMWeightsPath("l0")));
getSelectedModel().setInstalled(false);
} else if (getSelectedModel().getName().equals(EfficientViTSAML1.FULL_NAME)
&& new File(manager.getEfficientViTSAMWeightsPath("l1")).getParentFile().list().length != 1) {
Files.deleteFolder(new File(manager.getEfficientViTSAMWeightsPath("l1")));
getSelectedModel().setInstalled(false);
} else if (getSelectedModel().getName().equals(EfficientViTSAML2.FULL_NAME)
&& new File(manager.getEfficientViTSAMWeightsPath("l2")).getParentFile().list().length != 1) {
Files.deleteFolder(new File(manager.getEfficientViTSAMWeightsPath("l2")));
getSelectedModel().setInstalled(false);
} else if (getSelectedModel().getName().equals(EfficientViTSAMXL0.FULL_NAME)
&& new File(manager.getEfficientViTSAMWeightsPath("xl0")).getParentFile().list().length != 1) {
Files.deleteFolder(new File(manager.getEfficientViTSAMWeightsPath("xl0")));
getSelectedModel().setInstalled(false);
} else if (getSelectedModel().getName().equals(EfficientViTSAMXL1.FULL_NAME)
&& new File(manager.getEfficientViTSAMWeightsPath("xl1")).getParentFile().list().length != 1) {
Files.deleteFolder(new File(manager.getEfficientViTSAMWeightsPath("xl1")));
getSelectedModel().setInstalled(false);
} else if (getSelectedModel().getName().equals(EfficientViTSAML0.FULL_NAME)
|| getSelectedModel().getName().equals(EfficientViTSAML1.FULL_NAME)
|| getSelectedModel().getName().equals(EfficientViTSAML2.FULL_NAME)
|| getSelectedModel().getName().equals(EfficientViTSAMXL0.FULL_NAME)
|| getSelectedModel().getName().equals(EfficientViTSAMXL1.FULL_NAME)) {
Files.deleteFolder(new File(manager.getEfficientViTSamEnv()));
getSelectedModel().setInstalled(false);
}
getSelectedModel().getInstallationManger().uninstall();
getSelectedModel().setInstalled(false);
}

/**
Expand Down

0 comments on commit fc89712

Please sign in to comment.