0

I'd like to embed a simple PyTorch model in a webpage. Is this something accomplishable with brython? If not, is there another tool available that would allow for PyTorch scripts to be executed without a separate server hosting the code?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
DerekG
  • 3,555
  • 1
  • 11
  • 21
  • Does this answer your question? [How to import library using Brython](https://stackoverflow.com/questions/40001634/how-to-import-library-using-brython) – Karl Knechtel Feb 11 '23 at 20:33

1 Answers1

0

I am not sure about brython, but I believe torchserve can be used to accomplish your task.

Take a look at its documentation: https://pytorch.org/serve/

EDIT: Based on Comments:

So I found this repo, that is like a substitute for Tensorflow.js except if works for Pytorch. It is called torch.js. It should allow your model to work on a program made by node.js. Since this repo is not as official as tensorflow.js, another thing I would suggest is to possibly convert your Pytorch model to ONNX to then Tensorflow to then Tensorflow.js. Then you will be able to accomplish your task. Some links about tensorflow.js can be found here

SarthakJain
  • 1,226
  • 6
  • 11
  • Not quite what I'm looking for, I'd prefer the inference to actually be done client-side. This would require loading the model state dict of course, which is fairly sizeable. – DerekG Jul 20 '21 at 14:24