RuudVelo commited on
Commit
24d772d
1 Parent(s): 04c6369

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+ import pickle
5
+
6
+ learn = load_learner('snackdetector.pkl')
7
+
8
+ labels = learn.dls.vocab
9
+
10
+ def predict(img):
11
+
12
+ img = PILImage.create(img)
13
+
14
+ pred,pred_idx,probs = learn.predict(img)
15
+
16
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
17
+
18
+ title = "Dutch Snack Detector"
19
+
20
+ description = "Dutch Snack Detector: Detect your Dutch snack and enjoy"
21
+
22
+ examples = ['frikandel.jpg']
23
+
24
+ #interpretation='default'
25
+
26
+ enable_queue=True
27
+
28
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(224, 224)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()