You can do that with:
import torch
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
path = '/path/to/your/file.pt'
model = torch.hub.load("WongKinYiu/yolov7","custom",f"{path}",trust_repo=True)
To get results you can run
results = model("/path/to/your/photo")
To get bbox you can use:
results.pandas().xyxy
EDIT
I created a repository with a python package in order to this easily
https://github.com/Tlaloc-Es/aipose