Skip to content

Commit

Permalink
update 'em all
Browse files Browse the repository at this point in the history
  • Loading branch information
Xander Christopher committed Jan 28, 2024
1 parent 8d594c5 commit bbaf647
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
44 changes: 35 additions & 9 deletions AnimeGAN-v3/Scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,30 @@
} catch (error) {
console.error(error);
}
})
});
async function getSaveHandle(name) {
const opts = {
suggestedName: name,
types: [
{
description: "Image",
accept: {
'Image/*': [".png"],
},
},
],
};
let handle = await window.showSaveFilePicker(opts);
return handle;
};
function writeFile(handle, url) {
fetch(url).then(file=>{
URL.revokeObjectURL(url);
handle.createWritable().then(async (wt)=>{
await file.body.pipeTo(wt);
});
});
};
function predict(imag) {
const finalTensor = tf.tidy(() => {
let img = tf.browser.fromPixels(imag);
Expand Down Expand Up @@ -149,14 +172,17 @@
genBtn.disabled = false;
dwnBtn.classList.remove("hidden");
dwnBtn.addEventListener("click", () => {
canvas.toBlob((blob) => {
canvas.toBlob(async (blob) => {
let urle = URL.createObjectURL(blob);
let date = new Date();
saveAs(blob, `AnimeGANv3-prediction-${date.getTime()}.png`);
})
})
}
})
}
}
let name = `AnimeGANv3-prediction-${date.getTime()}.png`;
let svHndl = await getSaveHandle(name);
writeFile(svHndl, urle);
});
});
};
});
};
};
init();
})();
5 changes: 5 additions & 0 deletions AnimeGAN-v3/Styles/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/* Copyright (C)2023-present Xander Christopher(https://github.com/XandrChris) */
/* All Rights Reserved. */


* {
margin: 0;
}

.mnDv {
flex-direction: row;
gap: 10px;
Expand Down
1 change: 0 additions & 1 deletion AnimeGAN-v3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<script src="AnimeGAN-v3/Styles/style.css"></script>
<script src="Tf.js/tf.min.js"></script>
<script src="Tf.js/tf-tflite.min.js"></script>
<script src="assets/FileSaver/FileSaver.min.js"></script>
</head>

<body>
Expand Down
3 changes: 0 additions & 3 deletions assets/FileSaver/FileSaver.min.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/FileSaver/FileSaver.min.js.map

This file was deleted.

0 comments on commit bbaf647

Please sign in to comment.