devdata commited on
Commit
e1b6c83
1 Parent(s): 6114b97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -6,10 +6,12 @@ from fastai.vision.all import PILImage
6
  learn = load_learner('model.pkl')
7
 
8
  labels = learn.dls.vocab
 
9
  def predict(img):
10
- img = PILImage.create(img)
11
- pred,pred_idx,probs = learn.predict(img)
12
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
 
13
 
14
  examples = ['image.jpg']
15
 
 
6
  learn = load_learner('model.pkl')
7
 
8
  labels = learn.dls.vocab
9
+
10
  def predict(img):
11
+ img = PILImage.create(img)
12
+ img = img.resize((512, 512))
13
+ pred,pred_idx,probs = learn.predict(img)
14
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
15
 
16
  examples = ['image.jpg']
17