Hi! I have an idea to add import numpy as np
at the beginning of the code, because without it the final piece of code
for i in torch.topk(results, k=3).indices.tolist()[0]: print(f"{model.id2label[i]}: {np.round(results.flatten()[i].item(), 3)}")
does not work and it may not be obvious to all users.
Hi! I have an idea to add
import numpy as np
at the beginning of the code, because without it the final piece of codefor i in torch.topk(results, k=3).indices.tolist()[0]: print(f"{model.id2label[i]}: {np.round(results.flatten()[i].item(), 3)}")
does not work and it may not be obvious to all users.