Spaces:
Runtime error
Runtime error
Upload app.py
Browse filesAdd application file
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)
|