dr4g0n7ly commited on
Commit
2729fb4
·
1 Parent(s): 3ca437e

update app

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -1,16 +1,14 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
4
- learn_meander = load_learner('model_resnet_meander.pkl')
5
 
6
- categories = ('PD', 'Non-PD')
 
 
7
 
8
- def classify_image(img):
9
- pred,idx,probs = learn_meander.predict(img)
10
- return dict(zip(categories, map(float,probs)))
11
-
12
- image = gr.inputs.Image(shape=(200,200))
13
  label = gr.outputs.Label()
14
 
15
- iface = gr.Interface(fn=classify_image, inputs="text", outputs="text")
16
- iface.launch(inline=False)
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ learn = load_learner('model.pkl')
5
 
6
+ def classify_img(img):
7
+ pred,idx,probs = learn.predict(img)
8
+ return str(pred + ", probability: " + str(round(torch.max(probs).item(), 4)) )
9
 
10
+ image = gr.inputs.Image(shape=(192, 192))
 
 
 
 
11
  label = gr.outputs.Label()
12
 
13
+ intf = gr.Interface(fn=classify_img, inputs=image, outputs=label)
14
+ intf.launch(inline=False)