A short personal project of mine using tfjs.
Play around Demonstrates saving model in Python and loading it in tfjs for a Neural Network trained on MNIST.
Tensorflow 1.11
You must pip3 instal tensorflow==1.11
. For some reason, they are continuously
releasing backwards incompatible Tensorflow versions
pip3 install tensorflow==1.11
pip3 install tensorflowjs
python3 model_builder.py
python3 test_saved_model.py
TFJS requires you to do this to load model in browser
tensorflowjs_converter --input_format keras \
my_mnist_model.h5 \
tfjs_mnist
Alternatively, we can use the following line in the Python code as mentioned in the tfjs docs
tfjs.converters.save_keras_model(model, tfjs_target_dir)