Skip to content

Commit

Permalink
Freed up memory from saving model
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronge-2020 committed Feb 27, 2024
1 parent 744295c commit 39ea4b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main2.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,11 @@ const handleLoadImageUrlClick = async () => {
};

async function segmentImage(initializeParams = false) {

if (window.state === undefined) {
await initSegmentation();
}

const { threshold, maskAlpha, minArea, maxArea, disTransformMultiplier } =
getInputParameters();

Expand Down Expand Up @@ -949,6 +954,8 @@ function bindEventListeners() {

// Initialize and bind events
const initSegmentation = async () => {

debugger;
const state = await loadDependencies();
window.state = state;

Expand Down Expand Up @@ -1019,6 +1026,8 @@ const initSegmentation = async () => {
alert("No image uploaded!");
return;
}

window.state = undefined;
const getImageInfo = async () => {
const checkExtension = (path) =>
path.endsWith(".png") ||
Expand Down Expand Up @@ -1261,7 +1270,7 @@ async function downloadAllCores(cores) {
// Main function that runs the application
const run = async () => {
bindEventListeners();
// Run the app

initSegmentation();
};

Expand Down

0 comments on commit 39ea4b8

Please sign in to comment.