Jatayoo commited on
Commit
eee52e4
1 Parent(s): 8a5d776

Upload app.py

Browse files

Add application file

Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner('model_beeOrWasp.pkl')
5
+
6
+ labels = ('Bee', 'Wasp')
7
+ def predict(img):
8
+ pred, pred_idx, prob = learn.predict(img)
9
+ return dict(zip(labels, map(float, prob)))
10
+
11
+ image = gr.inputs.Image(shape=(192,192))
12
+ label = gr.outputs.Label()
13
+ examples = ['bee.jpg', 'wasp.jpg']
14
+
15
+ intf = gr.Interface(fn=predict,inputs=image,outputs=label)
16
+ intf.launch(inline=False, share=True)