JDA45 commited on
Commit
536659a
·
1 Parent(s): 792191b
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -23,11 +23,8 @@ def predict_fn(img):
23
  with torch.no_grad():
24
  out = model(img)
25
 
26
- probalilities = torch.nn.functional.softmax(out[0], dim=0)
27
-
28
- values, indices = torch.topk(probalilities, k=5)
29
-
30
- return [LABELS[i]: v.item() for i, v in zip(indices, values)]
31
- gr.Interface(predict_fn, gr.inputs.Image(type='pil'), outputs='label').launch()
32
 
 
33
 
 
 
23
  with torch.no_grad():
24
  out = model(img)
25
 
26
+ probabilities = torch.nn.functional.softmax(out[0], dim=0)
 
 
 
 
 
27
 
28
+ values, indices = torch.topk(probabilities, k=5)
29
 
30
+ return [{LABELS[i]: v.item()} for i, v in zip(indices, values)]