devdata commited on
Commit
bb5c9ff
·
1 Parent(s): 3b082e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -8,14 +8,13 @@ learn = load_learner('export.pkl')
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 = ['image1.jpg', 'image2.jpg']
17
- interpretation='default'
18
  enable_queue=True
19
 
20
- gr.Interface(fn=predict, inputs=gr.components.Image(), outputs=gr.components.Label(num_top_classes=3), examples=examples, interpretation=interpretation, enable_queue=enable_queue).launch()
21
 
 
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 = ['image1.jpg', 'image2.jpg']
 
17
  enable_queue=True
18
 
19
+ gr.Interface(fn=predict, inputs=gr.components.Image(), outputs=gr.components.Label(num_top_classes=3), examples=examples, enable_queue=enable_queue).launch()
20