anatexis commited on
Commit
4d6e03f
1 Parent(s): 0137ecc

changed predict function so it will not always show Ninjago, hopefully

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -4,14 +4,13 @@ import skimage
4
 
5
  learn = load_learner('export.pkl')
6
 
7
- categories = ('Lego Ninjago','Lego (non Ninjago)')
8
-
9
 
10
 
11
  def predict(img):
12
  img = PILImage.create(img)
13
  pred, pred_idx, probs = learn.predict(img)
14
- return dict(zip(categories, map(float,probs)))
15
 
16
 
17
  title = "Lego Classifier"
 
4
 
5
  learn = load_learner('export.pkl')
6
 
7
+ labels = ('Lego Ninjago', 'Lego (non Ninjago)')
 
8
 
9
 
10
  def predict(img):
11
  img = PILImage.create(img)
12
  pred, pred_idx, probs = learn.predict(img)
13
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
14
 
15
 
16
  title = "Lego Classifier"