Ethium commited on
Commit
f002879
1 Parent(s): b1e79a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -2,11 +2,13 @@ from fastai.vision.all import *
2
 
3
  learn = load_learner('your_model.pkl')
4
 
 
 
5
  labels = learn.dls.vocab
6
  def predict(img):
7
  img = PILImage.create(img)
8
  pred,pred_idx,probs = learn.predict(img)
9
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
10
 
11
  import gradio as gr
12
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
 
2
 
3
  learn = load_learner('your_model.pkl')
4
 
5
+ categories = ('Glaucoma Present','Glaucoma Absent')
6
+
7
  labels = learn.dls.vocab
8
  def predict(img):
9
  img = PILImage.create(img)
10
  pred,pred_idx,probs = learn.predict(img)
11
+ return dict(zip(categories, map(float,probs)))
12
 
13
  import gradio as gr
14
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)