ArpitaShenoy commited on
Commit
fa5eb33
1 Parent(s): 3583615

added extra condition to filter out the one with highest prob if the model should return a list

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -17,6 +17,10 @@ def classify_images(img):
17
  idxs = torch.where(probs>=0.90)
18
  if len(idxs[0])==0:
19
  return 'None'
 
 
 
 
20
  else:
21
  return learn.dls.vocab[idxs][0]
22
 
 
17
  idxs = torch.where(probs>=0.90)
18
  if len(idxs[0])==0:
19
  return 'None'
20
+ elif (len(idxs[0]>1)):
21
+ prob = sorted(probs, reverse=True)
22
+ idxs = torch.where(probs==prob[0])
23
+ return learn.dls.vocab[idxs][0]
24
  else:
25
  return learn.dls.vocab[idxs][0]
26