Skip to content

Instantly share code, notes, and snippets.

View Nithanaroy's full-sized avatar
🎯
Focusing

Nitin Pasumarthy Nithanaroy

🎯
Focusing
View GitHub Profile
@Nithanaroy
Nithanaroy / tfjs-drive-deploy-load-model.js
Last active August 28, 2021 17:51
Load Tensorflow JS model from Google Drive
async function loadModel() {
google.script.run.withSuccessHandler(async modelFiles => {
const modelJson = new File([modelFiles[0]], "model.json", { type: "application/json" })
const modelWeights = new File([Uint8Array.from(modelFiles[1])], "group1-shard1of1.bin")
model = await tf.loadLayersModel(tf.io.browserFiles([modelJson, modelWeights]))
model.summary();
}).withFailureHandler(onFailure).loadModelFromDrive();
}