Deploying a YOLOv5 Model with Flask
The following repository was helpful for deploying a YOLOv5 model using Flask.
It provides a simple web application with an image upload form, as well as REST API samples.
Loading a Custom Model
By modifying the arguments of the load function as follows, it was possible to load a locally trained custom model.
model = torch.hub.load("ultralytics/yolov5", "custom", path='model/best.pt', force_reload=True, autoshape=True)
Adjust the path value as needed. The force_reload and autoshape options are optional, and in my environment it worked without specifying them.