I just finished finetuning a pretrained facial recognition model that spits out an encoding for every image you send into it. I would now like to deploy it in an EC2 instance
Deploying your ML Model with TorchServe

This tutorial tells you how to set Torchserve up to get a reply as a simple class. How do I set something similar for my model. It needs to take an image, pass it through the model to get the encodings, and then compare them to every image encoding in the database and output the closest one.
Which is the most efficient way to achieve this?
Thanks!