Ethium commited on
Commit
4ec77fa
1 Parent(s): f002879

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from fastai.vision.all import *
 
2
 
3
  learn = load_learner('your_model.pkl')
4
 
@@ -6,9 +7,10 @@ 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)
 
 
 
1
  from fastai.vision.all import *
2
+ import gradio as gr
3
 
4
  learn = load_learner('your_model.pkl')
5
 
 
7
 
8
  labels = learn.dls.vocab
9
  def predict(img):
 
10
  pred,pred_idx,probs = learn.predict(img)
11
  return dict(zip(categories, map(float,probs)))
12
 
13
+ image = gr.inputs.Image(shape=(512,512))
14
+ label = gr.outputs.Label()
15
+ intf = gr.Interface(fn=predict, inputs=image, outputs=label)
16
+ intf.launch(inline=False)