Kaggle CSV files

Dear all,
I have trained a pre-trained Resnet50 classifier on the kaggle images dataset and label them as 0 for No-Covid 1 for Thorax diseases and 2 for covid.
now for the competition, I need to save these labels in the CSV files.
when I run the following code for evaluation of the test images,
total_imgs = 0
covid_positive = 0
for root, dirs, files in os.walk("/content/gdrive/My Drive/dlai3-phase3/VALIDATE/VALIDATE", topdown=False):
for name in files:
total_imgs += 1
#im_covid = Image.open(“data/test/covid/03BF7561-A9BA-4C3C-B8A0-D3E585F73F3C.jpeg”)
img = Image.open(os.path.join(root, name))
img = img.convert(‘RGB’)
pred, probs = predict_covid(img)
print(pred)

print the string labels, not the number. Could anyone please tell me how I can get the numeric labels? thanks

Your predict_covid method seems to return a string, so you would have to look into this method and check, what it is doing.
The standard PyTorch models return e.g. class logits and you could get the predicted class index via: preds = torch.argmax(outputs, dim=1) for a multi-class classification.

Thank you so much. I truly appreciate your help.