PS I just finished reading your new article. A few comments that may be of use to you:


Your browser should usually cache downloaded files (depends on your browser settings) so you should see it is faster to load after you have done it once (as you saw in your write up) and then having the model in singleton as you mentioned is correct for most use cases.


You only need to use localstorage / indexdb for offline functionality eg in a Progressive Web App or similar if you want the model to work offline.


We have function calls in our library APIs to save to localstorage / indexdb etc for you. See this page:

  
      

      TensorFlow
  

  
    

Save and load models  |  TensorFlow.js 2



  

  
    
    
  

  


That should make your life easier when working with “raw TFJS models” (when working with model.json directly) in the future beyond these pre-made easy to use classes!