Translate Tensors directly in Image To LaTex Model

I’ve trained an Image To Latex model to translate images to LaTex. I’m planning to use this model in a producer/consumer context where a translation script with the model is the consumer and consumes single image tensors one at a time, as they are provided by the producer. As I would rather not have the file system be involved as an intermediate step in this process, my goal is to find a simple way to be able to translate singleton tensors one at a time as they provided. Is there any easy way to do this? Right now I am looking through all the and classes and it seems like a convoluted soup of objects and iterators all written around reading from the file system. Any ideas in this regard?

You may have a look at the entry point and the onmt.translate.translation_server objects.
Not sure it was ever tested in the Im2Text use case, but I think you could adapt it without too much hassle.