Which framework makes it easy to run tensorflow.js code on backend then show result on website?

Looking to deploy a machine learning model preferably on a JAMstack framework such as Gatsby, Hugo etc. I was hoping someone had starter code that can make this process easier.

The goal is to have an end-user upload a document then the machine learning program displays some information to the end-user. After I’ll create an API to link the HTML page for another end-user.

So far the most I’ve done is update a sample Gatsby site and launch it via Netlify.

Thank you for your time.

Hi, @regarder, I don’t have code examples for doing something like this at Netlify. You would be the first person do to so (that I am aware of).

Are there any questions we can answer to assist you?

Thanks for the clarification, @regarder. First, it isn’t possible to run server side code at Netlify (the only exception being Netlify Functions).

However, Netlify Functions is limited to Node.js and Go at this time (so no Python).

You can still host a Python API with a different service (for example Heroku or AWS) and then use that API from the javascript on the site at Netlify.

Also, we have a in-depth topic about what is and isn’t possible at Netlify here:

There is also more documentation about getting Netlify CMS enabled for a site here:

Please let us know if there are other questions.

Hi @luke

Thank you for your response!

So far I was thinking I could use an API that’ll send data from a file upload function on doorway.ai as code shown below (Is there modern JS that can do do a multi-document simultaneous upload?).

var txt = "";
if ('files' in x) {
  if (x.files.length == 0) {
    txt = "Select one or more files.";
  } else {
    for (var i = 0; i < x.files.length; i++) {
      txt += "<br><strong>" + (i+1) + ". file</strong><br>";
      var file = x.files[i];
      if ('name' in file) {
        txt += "name: " + file.name + "<br>";
      }
      if ('size' in file) {
        txt += "size: " + file.size + " bytes <br>";
      }
    }
  }
}
document.getElementById ("demo").innerHTML = txt; ```
  
Then the uploaded documents will be processed on another server via Python 
and the returned Python response will be sent back via Python Graphql API 
(Graphene "open to other packages") on the Gatsby website page.

 Am I missing any critical steps to uploading documents directly from end user
 on Gatsby interface and sending them to another server to be processed via
 Python and return results on Gatsby / Netlify interface?

Thank you for your time once again!

Hi, @regarder, my ability to provide technical support is limited to Netlify’s hosting, services, and features.

Regarding which javascript library to use for a specific purpose, because that relates to the custom code of the site itself, it is outside our scope of support.

Maybe someone else reading this topic will have done this before and have suggestions. Similarly, if you find a method/library which works well for you, we would love to hear about that solution here.