I've been trying to add an knn block on the original Scratch3 webpage plantform.
I use the following code to load the required modules in the index.js file :
const tf = require('@tensorflow/tfjs/dist');
const knnClassifier = require('@tensorflow-models/knn-classifier');
const mobilenetModule = require('./mobilenet.js');
instead of the original version provided, which uses 'import' instead of the 'require'.
The thing is I have to use the 'require' because I can't open the Scratch3 webpage once I use 'import' to import a module. And when I use 'require', the 'isloaded' block yields the result of 'false',
instead of the 'true', which is different from the same block used on CodeLab website. (https://scratch3.codelab.club/)
I wish to know how may I successfully load the mobilenet.js in index.js. As you may have noticed,
I've followed the instructions provided in the readme.md file and also the index.js file provided along with it , although they proved to be useful since I successfully built my Scratch3 extensions with them , yet I can't really find an answer for this problem within them.
Do you have any suggestions for my problem? I really wish to make this work and I do thank you for considering my problem.
Hi, there.
I've been trying to add an knn block on the original Scratch3 webpage plantform. I use the following code to load the required modules in the index.js file : const tf = require('@tensorflow/tfjs/dist'); const knnClassifier = require('@tensorflow-models/knn-classifier'); const mobilenetModule = require('./mobilenet.js'); instead of the original version provided, which uses 'import' instead of the 'require'.
The thing is I have to use the 'require' because I can't open the Scratch3 webpage once I use 'import' to import a module. And when I use 'require', the 'isloaded' block yields the result of 'false', instead of the 'true', which is different from the same block used on CodeLab website. (https://scratch3.codelab.club/)
I wish to know how may I successfully load the mobilenet.js in index.js. As you may have noticed, I've followed the instructions provided in the readme.md file and also the index.js file provided along with it , although they proved to be useful since I successfully built my Scratch3 extensions with them , yet I can't really find an answer for this problem within them.
Do you have any suggestions for my problem? I really wish to make this work and I do thank you for considering my problem.